bkochuna / ners570f23-SpMV

1 stars 0 forks source link

Implement a matvec method for the DEN matrix class #26

Open KyleVaughn opened 11 months ago

KyleVaughn commented 11 months ago

Description:

The purpose of this issue is to implement a matvec method for the DEN matrix class. This method, is responsible for carrying out the matrix vector multiplication for the a 2-dimensional array stored in as a dense matrix where each element is populated with either non-zero values or with zero values. The function interface is virtual fp_type matvec(fp_type vecin)

After input, we process matrix vector multiplication as follows where the statement below is placed in a nested for loop that iterates for all elements in a[i][j]: b[i]=a[i][j]*x[j]

Tasks:

Definition of done:

Provided function is capable of performing matrix vector multiplication as required with the parameters that have been sent during the function call period.

KyleVaughn commented 11 months ago

Review by @preetb1199

Overall the description and definition looks details and precise. One important factor to considered that is missed is that there should be a check for the size of vector and the matrix because it is necessary the the number of elements in vector should be equal to the number of columns in the matrix for the correct matvec implementation.

Labels and projects not assigned.

Lazy-Beee commented 11 months ago

I would suggest using the function interface virtual fp_type* matvec(fp_type* vecin) and I'll add this to the SparseMatrix class.


Edit: change the api to avoid memory leak void matvec(fp_type* vecin, fp_type* vecout)