File view_matrix_csr.hpp

template<typename T>
class CsrView : public SparseMatrix<T>
#include <view_matrix_csr.hpp>

A two-dimensional view that provides row-wise access to values stored in a matrix in the compressed sparse row (CSR) format.

Template Parameters:

T – The type of the values, the view provides access to

Public Functions

inline CsrView(T *values, uint32 *indices, uint32 *indptr, uint32 numRows, uint32 numCols, T sparseValue = 0)
Parameters:
  • values – A pointer to an array of template type T that stores the values of all dense elements explicitly stored in the view

  • indices – A pointer to an array of type uint32, shape (numDenseElements), that stores the column indices, the values in values correspond to

  • indptr – A pointer to an array of type uint32, shape (numRows + 1), that stores the indices of the first element in values and indices that corresponds to a certain row. The index at the last position must be equal to numDenseElements

  • numRows – The number of rows in the view

  • numCols – The number of columns in the view

  • sparseValue – The value that should be used for sparse elements in the matrix

inline CsrView(const CsrView<T> &other)
Parameters:

other – A const reference to an object of type CsrView that should be copied

inline CsrView(CsrView<T> &&other)
Parameters:

other – A reference to an object of type CsrView that should be moved

inline virtual ~CsrView() override
inline SparseMatrix<T>::value_const_iterator values_cbegin(uint32 row) const

Returns a value_const_iterator to the beginning of the values in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

A value_const_iterator to the beginning of the values

inline SparseMatrix<T>::value_const_iterator values_cend(uint32 row) const

Returns a value_const_iterator to the end of the values in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

A value_const_iterator to the end of the values

inline SparseMatrix<T>::index_const_iterator indices_cbegin(uint32 row) const

Returns an index_const_iterator to the beginning of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_const_iterator to the beginning of the indices

inline SparseMatrix<T>::index_const_iterator indices_cend(uint32 row) const

Returns an index_const_iterator to the end of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_const_iterator to the end of the indices

inline SparseMatrix<T>::value_iterator values_begin(uint32 row)

Returns a value_iterator to the beginning of the values in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

A value_iterator to the beginning of the values

inline SparseMatrix<T>::value_iterator values_end(uint32 row)

Returns a value_iterator to the end of the values in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

A value_iterator to the end of the values

inline SparseMatrix<T>::index_iterator indices_begin(uint32 row)

Returns an index_iterator to the beginning of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_iterator to the beginning of the indices

inline SparseMatrix<T>::index_iterator indices_end(uint32 row)

Returns an index_iterator to the end of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_iterator to the end of the indices

inline uint32 getNumDenseElements() const

Returns the number of dense elements explicitly stored in the view.

Returns:

The number of dense elements explicitly stored in the view