Chi-Tech
|
#include <chi_math_sparse_matrix.h>
Data Structures | |
struct | ConstEntryReference |
class | ConstRowIteratorContext |
class | EntriesIterator |
struct | EntryReference |
class | RowIteratorContext |
Public Member Functions | |
SparseMatrix (size_t num_rows, size_t num_cols) | |
SparseMatrix (const SparseMatrix &in_matrix) | |
size_t | NumRows () const |
size_t | NumCols () const |
void | Insert (size_t i, size_t j, double value) |
void | InsertAdd (size_t i, size_t j, double value) |
double | ValueIJ (size_t i, size_t j) const |
void | SetDiagonal (const std::vector< double > &diag) |
void | Compress () |
std::string | PrintStr () const |
virtual | ~SparseMatrix ()=default |
RowIteratorContext | Row (size_t row_id) |
ConstRowIteratorContext | Row (size_t row_id) const |
EntriesIterator | begin () |
EntriesIterator | end () |
Data Fields | |
std::vector< std::vector< size_t > > | rowI_indices_ |
std::vector< std::vector< double > > | rowI_values_ |
Private Member Functions | |
void | CheckInitialized () const |
Private Attributes | |
size_t | row_size_ |
Maximum number of rows for this matrix. More... | |
size_t | col_size_ |
Maximum number of columns for this matrix. More... | |
Sparse matrix utility. This is a basic CSR type sparse matrix which allows efficient matrix storage and multiplication. It is not intended for solving linear systems (use PETSc for that instead). It was originally developed for the transfer matrices of transport cross-sections.
Definition at line 12 of file chi_math_sparse_matrix.h.
chi_math::SparseMatrix::SparseMatrix | ( | size_t | num_rows, |
size_t | num_cols | ||
) |
Constructor with number of rows and columns constructor.
Definition at line 11 of file chi_math_sparse_matrix.cc.
chi_math::SparseMatrix::SparseMatrix | ( | const SparseMatrix & | in_matrix | ) |
Copy constructor.
Definition at line 21 of file chi_math_sparse_matrix.cc.
|
virtualdefault |
SparseMatrix::EntriesIterator chi_math::SparseMatrix::begin | ( | ) |
Definition at line 270 of file chi_math_sparse_matrix.cc.
|
private |
Constructor with number of rows constructor.
Definition at line 250 of file chi_math_sparse_matrix.cc.
void chi_math::SparseMatrix::Compress | ( | ) |
Sorts the column indices of each row for faster lookup.
Definition at line 166 of file chi_math_sparse_matrix.cc.
SparseMatrix::EntriesIterator chi_math::SparseMatrix::end | ( | ) |
Definition at line 281 of file chi_math_sparse_matrix.cc.
void chi_math::SparseMatrix::Insert | ( | size_t | i, |
size_t | j, | ||
double | value | ||
) |
Inserts a value into the matrix.
Definition at line 38 of file chi_math_sparse_matrix.cc.
void chi_math::SparseMatrix::InsertAdd | ( | size_t | i, |
size_t | j, | ||
double | value | ||
) |
Inserts-Adds a value into the matrix with duplicate check.
Definition at line 69 of file chi_math_sparse_matrix.cc.
|
inline |
Definition at line 31 of file chi_math_sparse_matrix.h.
|
inline |
Definition at line 30 of file chi_math_sparse_matrix.h.
std::string chi_math::SparseMatrix::PrintStr | ( | ) | const |
Prints the sparse matrix to string.
Definition at line 211 of file chi_math_sparse_matrix.cc.
SparseMatrix::RowIteratorContext chi_math::SparseMatrix::Row | ( | size_t | row_id | ) |
Definition at line 264 of file chi_math_sparse_matrix.cc.
SparseMatrix::ConstRowIteratorContext chi_math::SparseMatrix::Row | ( | size_t | row_id | ) | const |
Definition at line 267 of file chi_math_sparse_matrix.cc.
void chi_math::SparseMatrix::SetDiagonal | ( | const std::vector< double > & | diag | ) |
Sets the diagonal of the matrix using a vector.
Definition at line 100 of file chi_math_sparse_matrix.cc.
double chi_math::SparseMatrix::ValueIJ | ( | size_t | i, |
size_t | j | ||
) | const |
Returns the value in the matrix at the given location. This is a rather inefficient routine. Use the columns and values rather than directly this function.
Definition at line 138 of file chi_math_sparse_matrix.cc.
|
private |
Maximum number of columns for this matrix.
Definition at line 16 of file chi_math_sparse_matrix.h.
|
private |
Maximum number of rows for this matrix.
Definition at line 15 of file chi_math_sparse_matrix.h.
std::vector<std::vector<size_t> > chi_math::SparseMatrix::rowI_indices_ |
rowI_indices[i] is a vector indices j for the non-zero columns.
Definition at line 21 of file chi_math_sparse_matrix.h.
std::vector<std::vector<double> > chi_math::SparseMatrix::rowI_values_ |
rowI_values[i] corresponds to column indices and contains the non-zero value.
Definition at line 24 of file chi_math_sparse_matrix.h.