#include <matrices.h>
Public Member Functions | |
SparseMatrix () | |
Default constructor. More... | |
SparseMatrix (const SparseMatrix &source_matrix) | |
Copy constructor. More... | |
void | operator= (const SparseMatrix &) |
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 |
Output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python). More... | |
virtual void | sparse_indexed_output_helper (std::ostream &outfile) const |
Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only. More... | |
![]() | |
Matrix () | |
(Empty) constructor More... | |
Matrix (const Matrix &matrix) | |
Broken copy constructor. More... | |
void | operator= (const Matrix &) |
Broken assignment operator. More... | |
virtual | ~Matrix () |
Virtual (empty) destructor. More... | |
T | operator() (const unsigned long &i, const unsigned long &j) const |
Round brackets to give access as a(i,j) for read only (we're not providing a general interface for component-wise write access since not all matrix formats allow efficient direct access!) The function uses the MATRIX_TYPE template parameter to call the get_entry() function which must be defined in all derived classes that are to be fully instantiated. More... | |
T & | operator() (const unsigned long &i, const unsigned long &j) |
Round brackets to give access as a(i,j) for read-write access. The function uses the MATRIX_TYPE template parameter to call the entry() function which must be defined in all derived classes that are to be fully instantiated. If the particular Matrix does not allow write access, the function should break with an error message. More... | |
virtual void | output (std::ostream &outfile) const |
Output function to print a matrix row-by-row, in the form a(0,0) a(0,1) ... a(1,0) a(1,1) ... ... to the stream outfile. Broken virtual since it might not be sensible to implement this for some sparse matrices. More... | |
void | sparse_indexed_output (std::ostream &outfile, const unsigned &precision=0, const bool &output_bottom_right_zero=false) const |
Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only with specified precision (if precision=0 then nothing is changed). If optional boolean flag is set to true we also output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python). More... | |
void | sparse_indexed_output (std::string filename, const unsigned &precision=0, const bool &output_bottom_right_zero=false) const |
Indexed output function to print a matrix to the file named filename as i,j,a(i,j) for a(i,j)!=0 only with specified precision. If optional boolean flag is set to true we also output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python). More... | |
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 |
Range check to catch when an index is out of bounds, if so, it issues a warning message and dies by throwing an OomphLibError . More... | |
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.
Definition at line 565 of file matrices.h.
|
inline |
Default constructor.
Definition at line 587 of file matrices.h.
|
inline |
Copy constructor.
Definition at line 590 of file matrices.h.
|
inlinevirtual |
Destructor, delete the memory associated with the values.
Definition at line 615 of file matrices.h.
|
inlinevirtual |
Return the number of columns of the matrix.
Implements oomph::Matrix< T, MATRIX_TYPE >.
Definition at line 627 of file matrices.h.
Referenced by oomph::SparseMatrix< double, CCMatrix< double > >::SparseMatrix().
|
inline |
Return the number of nonzero entries.
Definition at line 630 of file matrices.h.
Referenced by oomph::SuperLUSolver::factorise_distributed(), oomph::SuperLUSolver::factorise_serial(), oomph::MatrixBasedLumpedPreconditioner< oomph::CRDoubleMatrix >::setup(), and oomph::SparseMatrix< double, CCMatrix< double > >::SparseMatrix().
|
inlinevirtual |
Return the number of rows of the matrix.
Implements oomph::Matrix< T, MATRIX_TYPE >.
Definition at line 624 of file matrices.h.
Referenced by oomph::SparseMatrix< double, CCMatrix< double > >::SparseMatrix().
|
inline |
Broken assignment operator.
Definition at line 609 of file matrices.h.
|
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 > >.
Definition at line 635 of file matrices.h.
|
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 > >.
Definition at line 649 of file matrices.h.
|
inline |
Access to C-style value array.
Definition at line 618 of file matrices.h.
Referenced by oomph::SuperLUSolver::factorise_distributed(), oomph::SuperLUSolver::factorise_serial(), oomph::CCDoubleMatrix::multiply(), oomph::MatrixBasedLumpedPreconditioner< oomph::CRDoubleMatrix >::setup(), oomph::ILUZeroPreconditioner< CCDoubleMatrix >::setup(), and oomph::SparseMatrix< double, CCMatrix< double > >::SparseMatrix().
|
inline |
Access to C-style value array (const version)
Definition at line 621 of file matrices.h.
|
protected |
Number of columns.
Definition at line 576 of file matrices.h.
|
protected |
Number of rows.
Definition at line 573 of file matrices.h.
|
protected |
Number of non-zero values (i.e. size of Value array)
Definition at line 579 of file matrices.h.
|
protected |
Internal representation of the matrix values, a pointer.
Definition at line 570 of file matrices.h.
|
staticprotected |
Dummy zero.
Definition at line 582 of file matrices.h.