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

#include <triplet_form.hpp>

Collaboration diagram for triplet_form< data_t, index_t >:

Public Types

using data_type = data_t
 
using index_type = index_t
 

Public Member Functions

 triplet_form ()=default
 
 triplet_form (const triplet_form &)
 
 triplet_form (triplet_form &&) noexcept
 
triplet_formoperator= (const triplet_form &)
 
triplet_formoperator= (triplet_form &&) noexcept
 
 ~triplet_form ()=default
 
 triplet_form (const index_t in_rows, const index_t in_cols, const index_t in_elem=index_t(0))
 
template<sp_d in_dt>
 triplet_form (const SpMat< in_dt > &)
 
template<sp_d in_dt, sp_i in_it>
 triplet_form (triplet_form< in_dt, in_it > &, SparseBase=SparseBase::ZERO, bool=false)
 
template<sp_d in_dt, sp_i in_it>
 triplet_form (triplet_form< in_dt, in_it > &&in_mat, const SparseBase in_base=SparseBase::ZERO, const bool in_full=false)
 
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 ()
 
index_t row (const index_t I) const
 
index_t col (const index_t I) const
 
data_t val (const index_t I) const
 
bool is_csr_sorted () const
 
bool is_csc_sorted () const
 
bool is_empty () const
 
data_t max () const
 
void zeros ()
 
void init (const index_t in_elem)
 
void init (const index_t in_rows, const index_t in_cols, const index_t in_elem)
 
data_t operator() (const index_t row, const index_t col) const
 
data_t & at (index_t, index_t)
 
auto nullify (const index_t idx)
 
void hack_size (const index_t in_elem)
 Adjusts the size of the container by reserving space and updating the element count.
 
void print () const
 
void save (const std::string &) const
 Saves the triplet form matrix to a file.
 
void csr_sort ()
 Sorts the COO format into the CSR (Compressed Sparse Row) order.
 
void csc_sort ()
 Sorts the COO format into the CSC (Compressed Sparse Column) order.
 
void csr_condense ()
 
void csc_condense ()
 
void full_csr_condense ()
 
void full_csc_condense ()
 
void assemble (const Mat< data_t > &, const Col< uword > &)
 
template<sp_d in_dt, sp_i in_it>
void assemble (const triplet_form< in_dt, in_it > &, index_t, index_t, data_t)
 
template<sp_d in_dt, sp_i in_it>
void assemble (const triplet_form< in_dt, in_it > &in_mat, const std::vector< index_t > &row_shift, const std::vector< index_t > &col_shift, const std::vector< data_t > &scalar)
 
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 T2>
triplet_form operator* (T2) const
 
template<sp_d T2>
triplet_form operator/ (T2) const
 
template<sp_d T2>
triplet_formoperator*= (T2)
 
template<sp_d T2>
triplet_formoperator/= (T2)
 
triplet_form operator+ (const triplet_form &in_mat) const
 
triplet_form operator- (const triplet_form &in_mat) const
 
triplet_formoperator+= (const triplet_form &)
 
triplet_formoperator-= (const triplet_form &)
 
Col< data_t > diag () const
 
triplet_form diagonal () const
 
triplet_form strictly_upper () const
 
triplet_form strictly_lower () const
 
triplet_form upper () const
 
triplet_form lower () const
 
template<sp_d T2>
triplet_form< data_t, index_t > operator* (const T2 scalar) const
 
template<sp_d T2>
triplet_form< data_t, index_t > operator/ (const T2 scalar) const
 
template<sp_d T2>
triplet_form< data_t, index_t > & operator*= (const T2 scalar)
 
template<sp_d T2>
triplet_form< data_t, index_t > & operator/= (const T2 scalar)
 

Public Attributes

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

Friends

template<sp_d in_dt, sp_i in_it>
class csc_form
 
template<sp_d in_dt, sp_i in_it>
class csr_form
 
template<sp_d in_dt, sp_i in_it>
class triplet_form
 

Member Typedef Documentation

◆ data_type

template<sp_d data_t, sp_i index_t>
using triplet_form< data_t, index_t >::data_type = data_t

◆ index_type

template<sp_d data_t, sp_i index_t>
using triplet_form< data_t, index_t >::index_type = index_t

Constructor & Destructor Documentation

◆ triplet_form() [1/7]

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

◆ triplet_form() [2/7]

template<sp_d data_t, sp_i index_t>
triplet_form< data_t, index_t >::triplet_form ( const triplet_form< data_t, index_t > &  in_mat)
Here is the call graph for this function:

◆ triplet_form() [3/7]

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

◆ ~triplet_form()

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

◆ triplet_form() [4/7]

template<sp_d data_t, sp_i index_t>
triplet_form< data_t, index_t >::triplet_form ( const index_t  in_rows,
const index_t  in_cols,
const index_t  in_elem = index_t(0) 
)
inline
Here is the call graph for this function:

◆ triplet_form() [5/7]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt>
triplet_form< data_t, index_t >::triplet_form ( const SpMat< in_dt > &  in_mat)
explicit
Here is the call graph for this function:

◆ triplet_form() [6/7]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
triplet_form< data_t, index_t >::triplet_form ( triplet_form< in_dt, in_it > &  in_mat,
SparseBase  base = SparseBase::ZERO,
bool  full = false 
)
explicit
Here is the call graph for this function:

◆ triplet_form() [7/7]

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

Member Function Documentation

◆ assemble() [1/3]

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::assemble ( const Mat< data_t > &  in_mat,
const Col< uword > &  in_dof 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ assemble() [2/3]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
void triplet_form< data_t, index_t >::assemble ( const triplet_form< in_dt, in_it > &  in_mat,
index_t  row_shift,
index_t  col_shift,
data_t  scalar 
)
Here is the call graph for this function:

◆ assemble() [3/3]

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
void triplet_form< data_t, index_t >::assemble ( const triplet_form< in_dt, in_it > &  in_mat,
const std::vector< index_t > &  row_shift,
const std::vector< index_t > &  col_shift,
const std::vector< data_t > &  scalar 
)
inline
Here is the call graph for this function:

◆ at()

template<sp_d data_t, sp_i index_t>
data_t & triplet_form< data_t, index_t >::at ( index_t  row,
index_t  col 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ col()

template<sp_d data_t, sp_i index_t>
index_t triplet_form< data_t, index_t >::col ( const index_t  I) const
inline
Here is the caller graph for this function:

◆ col_mem() [1/2]

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

◆ col_mem() [2/2]

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

◆ csc_condense()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::csc_condense ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ csc_sort()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::csc_sort ( )

Sorts the COO format into the CSC (Compressed Sparse Column) order.

This function ensures that the COO representation of the matrix is sorted by column indices and then by row indices within each column.

Template Parameters
data_tThe data type of the matrix values.
index_tThe data type of the matrix indices.
Note
After calling this function:
  • The triplet form will be sorted.
  • Need to further call condense() to remove duplicate entries.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ csr_condense()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::csr_condense ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ csr_sort()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::csr_sort ( )

Sorts the COO format into the CSR (Compressed Sparse Row) order.

This function ensures that the COO representation of the matrix is sorted by row indices and then by column indices within each row.

Template Parameters
data_tThe data type of the matrix values.
index_tThe data type of the matrix indices.
Note
After calling this function:
  • The triplet form will be sorted.
  • Need to further call condense() to remove duplicate entries.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ diag()

template<sp_d data_t, sp_i index_t>
Col< data_t > triplet_form< data_t, index_t >::diag ( ) const
Here is the call graph for this function:

◆ diagonal()

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

◆ full_csc_condense()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::full_csc_condense ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ full_csr_condense()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::full_csr_condense ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hack_size()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::hack_size ( const index_t  in_elem)
inline

Adjusts the size of the container by reserving space and updating the element count.

This function reserves memory for the specified number of elements and updates the internal element count to match the provided value.

This function is dangerous and should be used with caution. It does not initialize the new elements, and the caller needs to fill them with valid data. Otherwise, the behavior is undefined.

Parameters
in_elemThe number of elements to reserve and set as the new size.
Here is the caller graph for this function:

◆ init() [1/2]

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::init ( const index_t  in_elem)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init() [2/2]

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::init ( const index_t  in_rows,
const index_t  in_cols,
const index_t  in_elem 
)
inline
Here is the call graph for this function:

◆ is_csc_sorted()

template<sp_d data_t, sp_i index_t>
bool triplet_form< data_t, index_t >::is_csc_sorted ( ) const
inline

◆ is_csr_sorted()

template<sp_d data_t, sp_i index_t>
bool triplet_form< data_t, index_t >::is_csr_sorted ( ) const
inline

◆ is_empty()

template<sp_d data_t, sp_i index_t>
bool triplet_form< data_t, index_t >::is_empty ( ) const
inline
Here is the caller graph for this function:

◆ lower()

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

◆ max()

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

◆ nullify()

template<sp_d data_t, sp_i index_t>
auto triplet_form< data_t, index_t >::nullify ( const index_t  idx)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator()()

template<sp_d data_t, sp_i index_t>
data_t triplet_form< data_t, index_t >::operator() ( const index_t  row,
const index_t  col 
) const
inline
Here is the call graph for this function:

◆ operator*() [1/4]

template<sp_d data_t, sp_i index_t>
Mat< data_t > triplet_form< data_t, index_t >::operator* ( const Col< data_t > &  in_mat) const
inline

◆ operator*() [2/4]

template<sp_d data_t, sp_i index_t>
Mat< data_t > triplet_form< data_t, index_t >::operator* ( const Mat< data_t > &  in_mat) const
inline

◆ operator*() [3/4]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form< data_t, index_t > triplet_form< data_t, index_t >::operator* ( const T2  scalar) const
Here is the call graph for this function:

◆ operator*() [4/4]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form triplet_form< data_t, index_t >::operator* ( T2  ) const

◆ operator*=() [1/2]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form< data_t, index_t > & triplet_form< data_t, index_t >::operator*= ( const T2  scalar)
Here is the call graph for this function:

◆ operator*=() [2/2]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form & triplet_form< data_t, index_t >::operator*= ( T2  )

◆ operator+()

template<sp_d data_t, sp_i index_t>
triplet_form triplet_form< data_t, index_t >::operator+ ( const triplet_form< data_t, index_t > &  in_mat) const
inline

◆ operator+=()

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

◆ operator-()

template<sp_d data_t, sp_i index_t>
triplet_form triplet_form< data_t, index_t >::operator- ( const triplet_form< data_t, index_t > &  in_mat) const
inline

◆ operator-=()

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

◆ operator/() [1/2]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form< data_t, index_t > triplet_form< data_t, index_t >::operator/ ( const T2  scalar) const
Here is the call graph for this function:

◆ operator/() [2/2]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form triplet_form< data_t, index_t >::operator/ ( T2  ) const

◆ operator/=() [1/2]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form< data_t, index_t > & triplet_form< data_t, index_t >::operator/= ( const T2  scalar)
Here is the call graph for this function:

◆ operator/=() [2/2]

template<sp_d data_t, sp_i index_t>
template<sp_d T2>
triplet_form & triplet_form< data_t, index_t >::operator/= ( T2  )

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ print()

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

◆ row()

template<sp_d data_t, sp_i index_t>
index_t triplet_form< data_t, index_t >::row ( const index_t  I) const
inline
Here is the caller graph for this function:

◆ row_mem() [1/2]

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

◆ row_mem() [2/2]

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

◆ save()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::save ( const std::string &  file_name) const

Saves the triplet form matrix to a file.

This function writes the matrix data stored in triplet form to a file. The file will contain the number of rows, columns, and non-zero elements on the first line, followed by the row indices, column indices, and values of the non-zero elements on subsequent lines. This follows the Matrix Market (MTX) format.

Template Parameters
data_tThe data type of the matrix values.
index_tThe data type of the row and column indices.
Parameters
file_nameThe name of the file to save the matrix to.
Note
If the file cannot be opened, the function will return without performing any operation.
Here is the call graph for this function:

◆ strictly_lower()

template<sp_d data_t, sp_i index_t>
triplet_form< data_t, index_t > triplet_form< data_t, index_t >::strictly_lower ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ strictly_upper()

template<sp_d data_t, sp_i index_t>
triplet_form< data_t, index_t > triplet_form< data_t, index_t >::strictly_upper ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ upper()

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

◆ val()

template<sp_d data_t, sp_i index_t>
data_t triplet_form< data_t, index_t >::val ( const index_t  I) 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 * triplet_form< data_t, index_t >::val_mem ( )
inline

◆ val_mem() [2/2]

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

◆ zeros()

template<sp_d data_t, sp_i index_t>
void triplet_form< data_t, index_t >::zeros ( )
inline
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ csc_form

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
friend class csc_form
friend

◆ csr_form

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
friend class csr_form
friend

◆ triplet_form

template<sp_d data_t, sp_i index_t>
template<sp_d in_dt, sp_i in_it>
friend class triplet_form
friend

Member Data Documentation

◆ n_alloc

template<sp_d data_t, sp_i index_t>
const index_t triplet_form< data_t, index_t >::n_alloc = 0

◆ n_cols

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

◆ n_elem

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

◆ n_rows

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

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