Class CsrMatrix

Class Documentation

class CsrMatrix

a sparse m x n matrix of doubles in compressed sparse rows

Public Types

using Triplet = std::tuple<std::size_t, std::size_t, double>

Public Functions

CsrMatrix(std::size_t m = 0, std::size_t n = 0)

the m x n zero matrix

CsrMatrix(std::size_t m, std::size_t n, std::vector<Triplet> T)

the m x n matrix of the triplets ( i , j , v ), the values of equal places summed

Pre:

i < m and j < n for each triplet, n < 2^32

explicit CsrMatrix(const SparseMatrix &S)

the matrix of the book’s orthogonal lists

inline std::size_t rows(void) const
inline std::size_t cols(void) const
inline std::size_t nonzeros(void) const
double get(std::size_t i, std::size_t j) const

the entry ( i , j ), by a binary search in the row

Pre:

i < m and j < n

std::vector<double> multiply(const std::vector<double> &x) const

y = A x

Pre:

x has n entries

void multiply(const double *x, double *y) const

y = A x into y, which must have m entries

Pre:

x has n entries and y m entries, apart from x

CsrMatrix transpose(void) const

the transpose, n x m

inline const std::size_t *rowStart(void) const

the offsets of the rows, the columns and the values

inline const std::uint32_t *columns(void) const
inline const double *values(void) const
bool operator==(const CsrMatrix&) const = default