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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started