Class SparseMatrix

Nested Relationships

Nested Types

Class Documentation

class SparseMatrix

a sparse matrix on orthogonal circular lists

Public Types

using const_iterator = detail::OrthogonalIterator<Node>

Public Functions

SparseMatrix(std::size_t m, std::size_t n)

the zero matrix of m rows and n columns

std::size_t rows(void) const
std::size_t cols(void) const
std::size_t nonzeros(void) const

the number of nonzero entries

double get(std::size_t i, std::size_t j) const
Pre:

i < m and j < n

void set(std::size_t i, std::size_t j, double v)

sets the entry ( i , j ) to v, removing its node if v is 0

Pre:

i < m and j < n

std::vector<std::pair<std::size_t, double>> row(std::size_t i) const

the nonzeros of the row i, by column

Pre:

i < m

std::vector<std::pair<std::size_t, double>> col(std::size_t j) const

the nonzeros of the column j, by row

Pre:

j < n

void pivot(std::size_t r, std::size_t c, double eps = 0)

the pivot step on the entry ( r , c ); entries below eps vanish

Pre:

r < m , c < n and the entry ( r , c ) is not 0

std::ranges::subrange<const_iterator> rowEntries(std::size_t i) const

the nonzeros of the row i as ( column , value ), by column

Pre:

i < m

std::ranges::subrange<const_iterator> colEntries(std::size_t j) const

the nonzeros of the column j as ( row , value ), by row

Pre:

j < n