suanPan
🧮 An Open Source, Parallel and Heterogeneous Finite Element Analysis Framework
Loading...
Searching...
No Matches
csr_form< data_t, index_t > Class Template Reference

#include <csr_form.hpp>

Collaboration diagram for csr_form< data_t, index_t >:

Public Member Functions

 csr_form ()=default
 
 csr_form (const csr_form &)
 
 csr_form (csr_form &&) noexcept
 
csr_formoperator= (const csr_form &)
 
csr_formoperator= (csr_form &&) noexcept
 
 ~csr_form ()=default
 
const index_t * row_mem () const
 
const index_t * col_mem () const
 
const data_t * val_mem () const
 
index_t * row_mem ()
 
index_t * col_mem ()
 
data_t * val_mem ()
 
data_t max () const
 
void print () const
 
template<sp_d T2>
csr_form operator* (const T2 scalar) const
 
template<sp_d T2>
csr_form operator/ (const T2 scalar) const
 
template<sp_d T2>
csr_formoperator*= (const T2 scalar)
 
template<sp_d T2>
csr_formoperator/= (const T2 scalar)
 
template<sp_d in_dt, sp_i in_it>
 csr_form (triplet_form< in_dt, in_it > &, SparseBase=SparseBase::ZERO, bool=false)
 Constructs a CSR (Compressed Sparse Row) representation of a sparse matrix from a triplet-form matrix.
 
template<sp_d in_dt, sp_i in_it>
 csr_form (triplet_form< in_dt, in_it > &&in_mat, const SparseBase in_base=SparseBase::ZERO, const bool in_full=false)
 
template<sp_d in_dt, sp_i in_it>
csr_formoperator= (triplet_form< in_dt, in_it > &)
 
data_t operator() (const index_t in_row, const index_t in_col) const
 
Mat< data_t > operator* (const Col< data_t > &in_mat) const
 
Mat< data_t > operator* (const Mat< data_t > &in_mat) const
 
template<sp_d in_dt, sp_i in_it>
csr_form< data_t, index_t > & operator= (triplet_form< in_dt, in_it > &in_mat)
 

Public Attributes

const index_t n_rows = 0
 
const index_t n_cols = 0
 
const index_t n_elem = 0
 

Constructor & Destructor Documentation

◆ csr_form() [1/5]

template<sp_d data_t, sp_i index_t>
csr_form< data_t, index_t >::csr_form ( )
default

◆ csr_form() [2/5]

template<sp_d data_t, sp_i index_t>
csr_form< data_t, index_t >::csr_form ( const csr_form< data_t, index_t > &  in_mat)

◆ csr_form() [3/5]

template<sp_d data_t, sp_i index_t>
csr_form< data_t, index_t >::csr_form ( csr_form< data_t, index_t > &&  in_mat)
noexcept

◆ ~csr_form()

template<sp_d data_t, sp_i index_t>
csr_form< data_t, index_t >::~csr_form ( )
default

◆ csr_form() [4/5]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
csr_form< data_t, index_t >::csr_form ( triplet_form< in_dt, in_it > &  in_mat,
SparseBase  base = SparseBase::ZERO,
bool  full = false 
)
explicit

Constructs a CSR (Compressed Sparse Row) representation of a sparse matrix from a triplet-form matrix.

Template Parameters
data_tThe data type of the values in the sparse matrix.
index_tThe data type of the indices in the sparse matrix.
in_dtThe data type of the input triplet-form matrix values.
in_itThe data type of the input triplet-form matrix indices.
Parameters
in_matThe input matrix in triplet form.
baseThe base for indexing (e.g., 0 for zero-based indexing, 1 for one-based indexing).
fullA boolean flag indicating whether to include all diagonal entries.

This constructor initializes the CSR representation of a sparse matrix by converting the input triplet-form matrix. Depending on the full parameter, it either fully condenses the triplet-form matrix or performs a partial condensation. The row pointers, column indices, and values are computed and stored in the CSR format. The indexing is adjusted based on the specified base (0 or 1).

Some sparse solvers require the presence of all diagonal entries in the matrix, even if some are zeros. The flag full indicates whether to include all diagonal entries in the CSR representation. This is useful to stamp out some weird segfaults.

Here is the call graph for this function:

◆ csr_form() [5/5]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
csr_form< data_t, index_t >::csr_form ( triplet_form< in_dt, in_it > &&  in_mat,
const SparseBase  in_base = SparseBase::ZERO,
const bool  in_full = false 
)
inlineexplicit

Member Function Documentation

◆ col_mem() [1/2]

template<sp_d data_t, sp_i index_t>
index_t * csr_form< data_t, index_t >::col_mem ( )
inline

◆ col_mem() [2/2]

template<sp_d data_t, sp_i index_t>
const index_t * csr_form< data_t, index_t >::col_mem ( ) const
inline
Here is the caller graph for this function:

◆ max()

template<sp_d data_t, sp_i index_t>
data_t csr_form< data_t, index_t >::max ( ) const
inline
Here is the call graph for this function:

◆ operator()()

template<sp_d data_t, sp_i index_t>
data_t csr_form< data_t, index_t >::operator() ( const index_t  in_row,
const index_t  in_col 
) const
inline

◆ operator*() [1/3]

template<sp_d data_t, sp_i index_t>
Mat< data_t > csr_form< data_t, index_t >::operator* ( const Col< data_t > &  in_mat) const
inline
Here is the call graph for this function:

◆ operator*() [2/3]

template<sp_d data_t, sp_i index_t>
Mat< data_t > csr_form< data_t, index_t >::operator* ( const Mat< data_t > &  in_mat) const
inline
Here is the call graph for this function:

◆ operator*() [3/3]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
csr_form csr_form< data_t, index_t >::operator* ( const T2  scalar) const
inline

◆ operator*=()

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
csr_form & csr_form< data_t, index_t >::operator*= ( const T2  scalar)
inline

◆ operator/()

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
csr_form csr_form< data_t, index_t >::operator/ ( const T2  scalar) const
inline

◆ operator/=()

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
csr_form & csr_form< data_t, index_t >::operator/= ( const T2  scalar)
inline

◆ operator=() [1/4]

template<sp_d data_t, sp_i index_t>
csr_form< data_t, index_t > & csr_form< data_t, index_t >::operator= ( const csr_form< data_t, index_t > &  in_mat)

◆ operator=() [2/4]

template<sp_d data_t, sp_i index_t>
csr_form< data_t, index_t > & csr_form< data_t, index_t >::operator= ( csr_form< data_t, index_t > &&  in_mat)
noexcept

◆ operator=() [3/4]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
csr_form & csr_form< data_t, index_t >::operator= ( triplet_form< in_dt, in_it > &  )

◆ operator=() [4/4]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
csr_form< data_t, index_t > & csr_form< data_t, index_t >::operator= ( triplet_form< in_dt, in_it > &  in_mat)
Here is the call graph for this function:

◆ print()

template<sp_d data_t, sp_i index_t>
void csr_form< data_t, index_t >::print ( ) const

◆ row_mem() [1/2]

template<sp_d data_t, sp_i index_t>
index_t * csr_form< data_t, index_t >::row_mem ( )
inline

◆ row_mem() [2/2]

template<sp_d data_t, sp_i index_t>
const index_t * csr_form< data_t, index_t >::row_mem ( ) const
inline
Here is the caller graph for this function:

◆ val_mem() [1/2]

template<sp_d data_t, sp_i index_t>
data_t * csr_form< data_t, index_t >::val_mem ( )
inline

◆ val_mem() [2/2]

template<sp_d data_t, sp_i index_t>
const data_t * csr_form< data_t, index_t >::val_mem ( ) const
inline
Here is the caller graph for this function:

Member Data Documentation

◆ n_cols

template<sp_d data_t, sp_i index_t>
const index_t csr_form< data_t, index_t >::n_cols = 0

◆ n_elem

template<sp_d data_t, sp_i index_t>
const index_t csr_form< data_t, index_t >::n_elem = 0

◆ n_rows

template<sp_d data_t, sp_i index_t>
const index_t csr_form< data_t, index_t >::n_rows = 0

The documentation for this class was generated from the following files: