the logic for multiplying a matrix: mat[row][col] and a vector : vec[row]
is the following?
It does not give the right answer.. anyone know what is wrong?Code:double *ans = malloc(rows * sizeof (double)); int i; for (i=0; i<rows; rows++) for (i=0; i<cols; cols++) ans[rows] = ans[rows] + mat[rows][cols] * vec[rows];
I used this site for the formula: Matrix-Vector Algebra