Displaying 1 result from an estimated 1 matches for "matrix_mult".
Did you mean:
matrix_mul
2006 Dec 03
1
passing matrix as argument to a C function
...function to work and similar functions
that take vectors as arguments. In my application I need to pass a couple
of matrices to the C function and could not figure out how to make it work
in C.
As an example, I tried to code first a simple matrix-vector product
function. Here is my code:
void matrix_mult( double **A, double *b, double *ab, int *nrow, int *ncol )
{
int i, j, nr = *nrow, nc = *ncol;
for( i = 0; i < nr; i++ )
{
ab[i] = 0.0;
for( j = 0; j < nc; j++ )
ab[i] += A[i][j] * b[j];
}
}
As I understand, passing the matrix A as (double **) is...