This adds functionality to the SparseMatrix library to access data stored in the CSR matrix subclass. This will be needed to perform the core sparse matrix-vector multiplication requirement of the SparseMatrix library. For a given (i,j) index, the corresponding element stored in the CSR format will be returned. If the data is not there in the CSR format, zero will be returned. Furthermore, a method to return the type of sparse storage will be implemented.
Tasks:
[ ] If there is not already a getFormat() in the SparseMatrix superclass, define that method. It should return the enumerated format type.
[ ] Check that the row and column indices are within the bounds of the matrix
[ ] Index the rowPtrs array at the row specified
[ ] Iterate through the colIdx array (or whatever the writer of the class calls it - I can check with them) until the desired column index is reached. If it isn't there then return zero.
Definition of done:
Must include getFormat() and operator()(size_t i, size_t j). The methods should be tested with the corresponding unit tests. Once tested, the implementation will be completed.
Description:
This adds functionality to the SparseMatrix library to access data stored in the CSR matrix subclass. This will be needed to perform the core sparse matrix-vector multiplication requirement of the SparseMatrix library. For a given (i,j) index, the corresponding element stored in the CSR format will be returned. If the data is not there in the CSR format, zero will be returned. Furthermore, a method to return the type of sparse storage will be implemented.
Tasks:
getFormat()
in the SparseMatrix superclass, define that method. It should return the enumerated format type.rowPtrs
array at the row specifiedcolIdx
array (or whatever the writer of the class calls it - I can check with them) until the desired column index is reached. If it isn't there then return zero.Definition of done:
Must include getFormat() and operator()(size_t i, size_t j). The methods should be tested with the corresponding unit tests. Once tested, the implementation will be completed.