void vecmat(double *x, double **a, int nra, int nca, double *b);
Premultiplies the matrix a[0..nra-1][0..nca-1] by the vector x[0..nra-1] and returns the product in the vector b[0..nca-1].
Parameters:
x | Left sided vector. |
---|---|
a | Right sided matrix. |
nra | Number of rows of a. |
nca | Number of columns of a. |
b | Product of x and a. |
Returns:
The product of x and a is returned in b.
Usage:
double** a; double* x; double* b; a = dmatrix(0, 3, 0, 4); x = dvector(0, 3); b = dvector(0, 4); // initialize a and x elements vecmat(x, a, 4, 5, b); free_dmatrix(a, 0, 3, 0); free_dvector(x, 0); free_dvector(b, 0);
Header:
#include "linalg.h"