![]() |
|
#include <matrices.h>
Public Member Functions | |
SparseMatrix () | |
Default constructor. More... | |
SparseMatrix (const SparseMatrix &source_matrix) | |
Copy constructor. More... | |
void | operator= (const SparseMatrix &)=delete |
Broken assignment operator. More... | |
virtual | ~SparseMatrix () |
Destructor, delete the memory associated with the values. More... | |
T * | value () |
Access to C-style value array. More... | |
const T * | value () const |
Access to C-style value array (const version) More... | |
unsigned long | nrow () const |
Return the number of rows of the matrix. More... | |
unsigned long | ncol () const |
Return the number of columns of the matrix. More... | |
unsigned long | nnz () const |
Return the number of nonzero entries. More... | |
virtual void | output_bottom_right_zero_helper (std::ostream &outfile) const |
virtual void | sparse_indexed_output_helper (std::ostream &outfile) const |
![]() | |
Matrix () | |
(Empty) constructor More... | |
Matrix (const Matrix &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const Matrix &)=delete |
Broken assignment operator. More... | |
virtual | ~Matrix () |
Virtual (empty) destructor. More... | |
T | operator() (const unsigned long &i, const unsigned long &j) const |
T & | operator() (const unsigned long &i, const unsigned long &j) |
virtual void | output (std::ostream &outfile) const |
void | sparse_indexed_output (std::ostream &outfile, const unsigned &precision=0, const bool &output_bottom_right_zero=false) const |
void | sparse_indexed_output (std::string filename, const unsigned &precision=0, const bool &output_bottom_right_zero=false) const |
Protected Attributes | |
T * | Value |
Internal representation of the matrix values, a pointer. More... | |
unsigned long | N |
Number of rows. More... | |
unsigned long | M |
Number of columns. More... | |
unsigned long | Nnz |
Number of non-zero values (i.e. size of Value array) More... | |
Static Protected Attributes | |
static T | Zero = T(0) |
Dummy zero. More... | |
Additional Inherited Members | |
![]() | |
void | range_check (const unsigned long &i, const unsigned long &j) const |
//////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// Class for sparse matrices, that store only the non-zero values in a linear array in memory. The details of the array indexing vary depending on the storage scheme used. The MATRIX_TYPE template parameter for use in the curious recursive template pattern is included and passed directly to the base Matrix class.
|
inline |
Default constructor.
|
inline |
Copy constructor.
References i, oomph::SparseMatrix< T, MATRIX_TYPE >::N, oomph::SparseMatrix< T, MATRIX_TYPE >::ncol(), oomph::SparseMatrix< T, MATRIX_TYPE >::Nnz, oomph::SparseMatrix< T, MATRIX_TYPE >::nnz(), oomph::SparseMatrix< T, MATRIX_TYPE >::nrow(), oomph::SparseMatrix< T, MATRIX_TYPE >::Value, and oomph::SparseMatrix< T, MATRIX_TYPE >::value().
|
inlinevirtual |
Destructor, delete the memory associated with the values.
References oomph::SparseMatrix< T, MATRIX_TYPE >::Value.
|
inlinevirtual |
Return the number of columns of the matrix.
Implements oomph::Matrix< T, MATRIX_TYPE >.
Reimplemented in oomph::CCDoubleMatrix.
References oomph::SparseMatrix< T, MATRIX_TYPE >::M.
Referenced by oomph::CRDoubleMatrix::ncol(), and oomph::SparseMatrix< T, MATRIX_TYPE >::SparseMatrix().
|
inline |
Return the number of nonzero entries.
References oomph::SparseMatrix< T, MATRIX_TYPE >::Nnz.
Referenced by oomph::SuperLUSolver::factorise_serial(), oomph::CRDoubleMatrix::nnz(), oomph::MatrixBasedLumpedPreconditioner< MATRIX >::setup(), and oomph::SparseMatrix< T, MATRIX_TYPE >::SparseMatrix().
|
inlinevirtual |
Return the number of rows of the matrix.
Implements oomph::Matrix< T, MATRIX_TYPE >.
Reimplemented in oomph::CCDoubleMatrix.
References oomph::SparseMatrix< T, MATRIX_TYPE >::N.
Referenced by oomph::SparseMatrix< T, MATRIX_TYPE >::SparseMatrix().
|
delete |
Broken assignment operator.
|
inlinevirtual |
Output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python).
Implements oomph::Matrix< T, MATRIX_TYPE >.
Reimplemented in oomph::CCMatrix< T >, oomph::CCMatrix< double >, oomph::CCMatrix< std::complex< double > >, oomph::CRMatrix< T >, oomph::CRMatrix< double >, and oomph::CRMatrix< std::complex< double > >.
References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().
|
inlinevirtual |
Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only.
Implements oomph::Matrix< T, MATRIX_TYPE >.
Reimplemented in oomph::CCMatrix< T >, oomph::CCMatrix< double >, oomph::CCMatrix< std::complex< double > >, oomph::CRMatrix< T >, oomph::CRMatrix< double >, and oomph::CRMatrix< std::complex< double > >.
References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().
|
inline |
Access to C-style value array.
References oomph::SparseMatrix< T, MATRIX_TYPE >::Value.
Referenced by oomph::SuperLUSolver::factorise_serial(), oomph::CRDoubleMatrix::inf_norm(), oomph::CRDoubleMatrix::matrix_reduction(), oomph::CCDoubleMatrix::multiply(), oomph::CRDoubleMatrix::multiply(), oomph::CRDoubleMatrix::multiply_transpose(), oomph::MatrixBasedLumpedPreconditioner< MATRIX >::setup(), oomph::ILUZeroPreconditioner< CCDoubleMatrix >::setup(), oomph::SparseMatrix< T, MATRIX_TYPE >::SparseMatrix(), and oomph::CRDoubleMatrix::value().
|
inline |
Access to C-style value array (const version)
References oomph::SparseMatrix< T, MATRIX_TYPE >::Value.
|
protected |
Number of columns.
Referenced by oomph::CCDoubleMatrix::multiply(), oomph::CRComplexMatrix::multiply_transpose(), oomph::CCComplexMatrix::multiply_transpose(), and oomph::SparseMatrix< T, MATRIX_TYPE >::ncol().
|
protected |
Number of rows.
Referenced by oomph::CRComplexMatrix::clean_up_memory(), oomph::CCComplexMatrix::clean_up_memory(), oomph::CRComplexMatrix::lubksub(), oomph::CCComplexMatrix::lubksub(), oomph::CRComplexMatrix::ludecompose(), oomph::CCComplexMatrix::ludecompose(), oomph::CCDoubleMatrix::multiply(), oomph::CRComplexMatrix::multiply(), oomph::CCComplexMatrix::multiply(), oomph::CCDoubleMatrix::multiply_transpose(), oomph::CRComplexMatrix::multiply_transpose(), oomph::CCComplexMatrix::multiply_transpose(), oomph::SparseMatrix< T, MATRIX_TYPE >::nrow(), oomph::CRComplexMatrix::residual(), oomph::CCComplexMatrix::residual(), and oomph::SparseMatrix< T, MATRIX_TYPE >::SparseMatrix().
|
protected |
Number of non-zero values (i.e. size of Value array)
Referenced by oomph::CRComplexMatrix::clean_up_memory(), oomph::CCComplexMatrix::clean_up_memory(), oomph::CRComplexMatrix::lubksub(), oomph::CCComplexMatrix::lubksub(), oomph::CRComplexMatrix::ludecompose(), oomph::CCComplexMatrix::ludecompose(), oomph::CCDoubleMatrix::multiply(), oomph::SparseMatrix< T, MATRIX_TYPE >::nnz(), and oomph::SparseMatrix< T, MATRIX_TYPE >::SparseMatrix().
|
protected |
Internal representation of the matrix values, a pointer.
Referenced by oomph::CRComplexMatrix::clean_up_memory(), oomph::CCComplexMatrix::clean_up_memory(), oomph::CRComplexMatrix::lubksub(), oomph::CCComplexMatrix::lubksub(), oomph::CRComplexMatrix::ludecompose(), oomph::CCComplexMatrix::ludecompose(), oomph::CCDoubleMatrix::matrix_reduction(), oomph::CCDoubleMatrix::multiply(), oomph::CRComplexMatrix::multiply(), oomph::CCComplexMatrix::multiply(), oomph::CCDoubleMatrix::multiply_transpose(), oomph::CRComplexMatrix::multiply_transpose(), oomph::CCComplexMatrix::multiply_transpose(), oomph::CRComplexMatrix::residual(), oomph::CCComplexMatrix::residual(), oomph::SparseMatrix< T, MATRIX_TYPE >::SparseMatrix(), oomph::SparseMatrix< T, MATRIX_TYPE >::value(), and oomph::SparseMatrix< T, MATRIX_TYPE >::~SparseMatrix().
|
staticprotected |
Dummy zero.