Question: I need a function to multiply a matrix by a scaler. struct _matrix { int rows; int cols; double * data; }; int nRows(matrix const

I need a function to multiply a matrix by a scaler. structI need a function to multiply a matrix by a scaler.

struct _matrix { int rows; int cols; double * data; };

int nRows(matrix const * mtx, int * n) { if (!mtx || !n) return -1; *n = mtx->rows; return 0; }

int nCols(matrix const * mtx, int * n) { if (!mtx || !n) return -1; *n = mtx->cols; return 0; }

Exercise 6.10. Implement a function that sets a matrix to its product with a scalar: 1/Sets each element of mta to the product of that element * with s. Returns -1 if mtx is NULL and 0 otheru, ise. int scalarProduct (double s, matrix * mtx)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!