ezp
lightweight C++ wrapper for selected distributed solvers for linear systems
Loading...
Searching...
No Matches
ezp::sparse_csr_mat< DT, IT > Struct Template Referencefinal
Collaboration diagram for ezp::sparse_csr_mat< DT, IT >:
[legend]

Public Member Functions

 sparse_csr_mat (const sparse_csr_mat &other)
 
 sparse_csr_mat (sparse_csr_mat &&)=delete
 
sparse_csr_mat & operator= (const sparse_csr_mat &)=delete
 
sparse_csr_mat & operator= (sparse_csr_mat &&)=default
 
 sparse_csr_mat (const IT n, const IT nnz, IT *const row_ptr, IT *const col_idx, DT *const data)
 
template<data_t DT2, index_t IT2>
 sparse_csr_mat (const sparse_coo_mat< DT2, IT2 > &coo, const bool one_based=false, const bool full=false)
 
template<data_t DT2, index_t IT2>
auto condense (const sparse_coo_mat< DT2, IT2 > &coo, const std::vector< IT2 > &index, const bool one_based, const bool full)
 
auto insert_missing_diagonals (const IT shift)
 
auto is_valid ()
 

Public Attributes

IT n {}
 
IT nnz {}
 
IT * row_ptr {nullptr}
 
IT * col_idx {nullptr}
 
DT * data {nullptr}
 
std::vector< IT > row_storage
 
std::vector< IT > col_storage
 
std::vector< DT > data_storage
 

Constructor & Destructor Documentation

◆ sparse_csr_mat()

template<data_t DT, index_t IT>
template<data_t DT2, index_t IT2>
ezp::sparse_csr_mat< DT, IT >::sparse_csr_mat ( const sparse_coo_mat< DT2, IT2 > &  coo,
const bool  one_based = false,
const bool  full = false 
)
inlineexplicit

Construct a CSR matrix from a COO matrix. The input matrix will be sorted, duplicated entries will be summed.

Parameters
cooThe input matrix in the COO format.
one_basedIndicate if the input matrix uses one based indexing (if true) or zero based indexing (if false). This flag will be used to generate correct row indexing.
fullSome solvers require diagonal entries to be explicitly present even if they are trivial, if true, all diagonal entries will be explicitly set regardless of the actual values.
Here is the call graph for this function:

Member Function Documentation

◆ condense()

template<data_t DT, index_t IT>
template<data_t DT2, index_t IT2>
auto ezp::sparse_csr_mat< DT, IT >::condense ( const sparse_coo_mat< DT2, IT2 > &  coo,
const std::vector< IT2 > &  index,
const bool  one_based,
const bool  full 
)
inline

Sum duplicated entries, drop trivial entries and build the row pointer in a single pass.

Parameters
cooThe input matrix in the COO format.
indexThe permutation that sorts the COO entries by row then by column.
one_basedIndicate if the input matrix uses one based indexing.
fullIf true, explicitly present diagonal entries are kept even if they are trivial.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_missing_diagonals()

template<data_t DT, index_t IT>
auto ezp::sparse_csr_mat< DT, IT >::insert_missing_diagonals ( const IT  shift)
inline

Ensure every diagonal entry is explicitly present. The main pass above can only keep a diagonal entry that already appears (with any value, including a trivial one) in the input COO matrix. If a diagonal entry is entirely absent from the input, it must be synthesized here with a value of zero, as documented for the full flag.

Parameters
shiftThe indexing shift (0 or 1) used for row/col pointers.
Here is the caller graph for this function:

The documentation for this struct was generated from the following file: