![]() |
|
#include <matrices.h>
Public Member Functions | |
CCMatrix () | |
Default constructor. More... | |
CCMatrix (const Vector< T > &value, const Vector< int > &row_index_, const Vector< int > &column_start_, const unsigned long &n, const unsigned long &m) | |
CCMatrix (const CCMatrix &source_matrix) | |
Copy constructor. More... | |
void | operator= (const CCMatrix &)=delete |
Broken assignment operator. More... | |
virtual | ~CCMatrix () |
Destructor, delete any allocated memory. More... | |
T | get_entry (const unsigned long &i, const unsigned long &j) const |
T & | entry (const unsigned long &i, const unsigned long &j) |
int * | column_start () |
Access to C-style column_start array. More... | |
const int * | column_start () const |
Access to C-style column_start array (const version) More... | |
int * | row_index () |
Access to C-style row index array. More... | |
const int * | row_index () const |
Access to C-style row index array (const version) More... | |
void | output_bottom_right_zero_helper (std::ostream &outfile) const |
void | sparse_indexed_output_helper (std::ostream &outfile) const |
void | clean_up_memory () |
Wipe matrix data and set all values to 0. More... | |
void | build (const Vector< T > &value, const Vector< int > &row_index, const Vector< int > &column_start, const unsigned long &n, const unsigned long &m) |
void | build_without_copy (T *value, int *row_index, int *column_start, const unsigned long &nnz, const unsigned long &n, const unsigned long &m) |
![]() | |
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... | |
![]() | |
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 | |
int * | Row_index |
Row index. More... | |
int * | Column_start |
Start index for column. More... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
void | range_check (const unsigned long &i, const unsigned long &j) const |
![]() | |
static T | Zero |
Dummy zero. More... | |
/////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// A class for compressed column matrices: a sparse matrix format The class is passed as the MATRIX_TYPE paramater so that the base class can use the specific access functions in the round-bracket operator.
|
inline |
Default constructor.
References oomph::CCMatrix< T >::Column_start, and oomph::CCMatrix< T >::Row_index.
|
inline |
Constructor: Pass vector of values, vector of row indices, vector of column starts and number of rows (can be suppressed for square matrices). Number of nonzero entries is read off from value, so make sure the vector has been shrunk to its correct length.
References oomph::CCMatrix< T >::build(), oomph::CCMatrix< T >::Column_start, m, n, oomph::CCMatrix< T >::Row_index, and oomph::SparseMatrix< T, CCMatrix< T > >::value().
|
inline |
Copy constructor.
References oomph::CCMatrix< T >::column_start(), oomph::CCMatrix< T >::Column_start, i, oomph::SparseMatrix< T, CCMatrix< T > >::M, oomph::SparseMatrix< T, CCMatrix< T > >::Nnz, oomph::CCMatrix< T >::row_index(), and oomph::CCMatrix< T >::Row_index.
|
inlinevirtual |
Destructor, delete any allocated memory.
References oomph::CCMatrix< T >::Column_start, and oomph::CCMatrix< T >::Row_index.
void oomph::CCMatrix< T >::build | ( | const Vector< T > & | value, |
const Vector< int > & | row_index_, | ||
const Vector< int > & | column_start_, | ||
const unsigned long & | n, | ||
const unsigned long & | m | ||
) |
Build matrix from compressed representation. Number of nonzero entries is read off from value, so make sure the vector has been shrunk to its correct length.
References i, m, n, N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and Eigen::value.
Referenced by oomph::CCMatrix< T >::CCMatrix().
void oomph::CCMatrix< T >::build_without_copy | ( | T * | value, |
int * | row_index, | ||
int * | column_start, | ||
const unsigned long & | nnz, | ||
const unsigned long & | n, | ||
const unsigned long & | m | ||
) |
Function to build matrix from pointers to arrays which hold the column starts, row indices and non-zero values. The final parameters specifies the number of rows and columns. Note that, as the name suggests, this function does not make a copy of the data pointed to by the first three arguments!
Build matrix from compressed representation. Note that, as the name suggests, this function does not make a copy of the data pointed to by the first three arguments!
References m, n, N, and Eigen::value.
Referenced by oomph::Problem::get_jacobian(), and oomph::CCDoubleMatrix::multiply().
void oomph::CCMatrix< T >::clean_up_memory |
Wipe matrix data and set all values to 0.
///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
References N.
|
inline |
Access to C-style column_start array.
References oomph::CCMatrix< T >::Column_start.
Referenced by oomph::CCMatrix< T >::CCMatrix(), oomph::SuperLUSolver::factorise_serial(), oomph::CCDoubleMatrix::multiply(), and oomph::ILUZeroPreconditioner< CCDoubleMatrix >::setup().
|
inline |
Access to C-style column_start array (const version)
References oomph::CCMatrix< T >::Column_start.
|
inline |
Read-write access is not permitted for these matrices and is deliberately broken.
References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().
|
inline |
Access function that will be called by the read-only round-bracket operator (const)
References oomph::CCMatrix< T >::Column_start, i, j, k, oomph::Matrix< T, MATRIX_TYPE >::range_check(), oomph::CCMatrix< T >::Row_index, oomph::SparseMatrix< T, CCMatrix< T > >::Value, and oomph::SparseMatrix< T, CCMatrix< T > >::Zero.
Referenced by oomph::CCDoubleMatrix::operator()().
|
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).
Reimplemented from oomph::SparseMatrix< T, CCMatrix< T > >.
References oomph::SparseMatrix< T, CCMatrix< T > >::N, and oomph::Matrix< T, MATRIX_TYPE >::operator()().
|
inline |
Access to C-style row index array.
References oomph::CCMatrix< T >::Row_index.
Referenced by oomph::CCMatrix< T >::CCMatrix(), oomph::SuperLUSolver::factorise_serial(), oomph::CCDoubleMatrix::multiply(), oomph::MatrixBasedLumpedPreconditioner< MATRIX >::setup(), and oomph::ILUZeroPreconditioner< CCDoubleMatrix >::setup().
|
inline |
Access to C-style row index array (const version)
References oomph::CCMatrix< T >::Row_index.
|
inlinevirtual |
Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only.
Reimplemented from oomph::SparseMatrix< T, CCMatrix< T > >.
References oomph::CCMatrix< T >::Column_start, j, k, oomph::SparseMatrix< T, CCMatrix< T > >::N, oomph::CCMatrix< T >::Row_index, and oomph::SparseMatrix< T, CCMatrix< T > >::Value.
|
protected |
Start index for column.
Referenced by oomph::CCMatrix< T >::CCMatrix(), oomph::CCMatrix< T >::column_start(), oomph::CCMatrix< T >::get_entry(), oomph::CCMatrix< T >::sparse_indexed_output_helper(), and oomph::CCMatrix< T >::~CCMatrix().
|
protected |