12 lines
284 B
C
12 lines
284 B
C
|
#include <R.h>
|
||
|
#include <Rinternals.h>
|
||
|
|
||
|
void c_sum_matrix(double *matrix, int *nrow, int *ncol, double *result) {
|
||
|
int i, j;
|
||
|
*result = 0.0;
|
||
|
for (i = 0; i < *nrow; i++) {
|
||
|
for (j = 0; j < *ncol; j++) {
|
||
|
*result += matrix[i * (*ncol) + j];
|
||
|
}
|
||
|
}
|
||
|
}
|