Question: Please help with this function: /* This function calculates the sparse matrix-vector multiply from the matrix in CSR format (i.e., csr_row_ptr, csr_col_ind, and csr_vals) and

Please help with this function:

/* This function calculates the sparse matrix-vector multiply from the matrix

in CSR format (i.e., csr_row_ptr, csr_col_ind, and csr_vals) and the vector

in an array (i.e., vector_x). It stores the result in another array (i.e., res)

input parameters:

these are 'consumed' by this function

unsigned int** csr_row_ptr row pointers to csr_col_ind and csr_vals in CSR

unsigned int** csr_col_ind column index for the non-zeros in CSR

double** csr_vals values for the non-zeros in CSR

int m # of rows in the matrix

int n # of columns in the matrix

int nnz # of non-zeros in the matrix

double vector_x input vector

these are 'produced' by this function

double* res Result of SpMV. res = A * x, where A is stored in CSR format and x is stored in vector_x

return parameters:

none

*/

void spmv(unsigned int* csr_row_ptr, unsigned int* csr_col_ind, double* csr_vals, int m, int n, int nnz, double* vector_x, double* res)

{

/* TODO */

}

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!