![]() |
|
#include <matrices.h>
Public Member Functions | |
CRMatrix () | |
Default constructor. More... | |
CRMatrix (const Vector< T > &value, const Vector< int > &column_index_, const Vector< int > &row_start_, const unsigned long &n, const unsigned long &m) | |
CRMatrix (const CRMatrix &source_matrix) | |
Copy constructor. More... | |
void | operator= (const CRMatrix &)=delete |
Broken assignment operator. More... | |
virtual | ~CRMatrix () |
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) |
The read-write access function is deliberately broken. More... | |
int * | row_start () |
Access to C-style row_start array. More... | |
const int * | row_start () const |
Access to C-style row_start array (const version) More... | |
int * | column_index () |
Access to C-style column index array. More... | |
const int * | column_index () const |
Access to C-style column 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 > &column_index, const Vector< int > &row_start, const unsigned long &n, const unsigned long &m) |
void | build_without_copy (T *value, int *column_index, int *row_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 * | Column_index |
Column index. More... | |
int * | Row_start |
Start index for row. 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 row matrices, a sparse storage format Once again the recursive template trick is used to inform that base class that is should use the access functions provided in the CRMatrix class.
|
inline |
Default constructor.
References oomph::CRMatrix< T >::Column_index, and oomph::CRMatrix< T >::Row_start.
|
inline |
Constructor: Pass vector of values, vector of column indices, vector of row starts and number of rows and columns Number of nonzero entries is read off from value, so make sure the vector has been shrunk to its correct length.
References oomph::CRMatrix< T >::build(), oomph::CRMatrix< T >::Column_index, m, n, oomph::CRMatrix< T >::Row_start, and oomph::SparseMatrix< T, CRMatrix< T > >::value().
|
inline |
Copy constructor.
References oomph::CRMatrix< T >::column_index(), oomph::CRMatrix< T >::Column_index, i, oomph::SparseMatrix< T, CRMatrix< T > >::N, oomph::SparseMatrix< T, CRMatrix< T > >::Nnz, oomph::CRMatrix< T >::row_start(), and oomph::CRMatrix< T >::Row_start.
|
inlinevirtual |
Destructor, delete any allocated memory.
References oomph::CRMatrix< T >::Column_index, and oomph::CRMatrix< T >::Row_start.
void oomph::CRMatrix< T >::build | ( | const Vector< T > & | value, |
const Vector< int > & | column_index_, | ||
const Vector< int > & | row_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. This matrix forms the storage for CRDoubleMatrices which are distributable. The argument n should be the number of local rows. The argument m is the number of columns
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. The optional final parameter specifies the number of columns. If it is not specified the matrix is assumed to be quadratic.
References i, m, n, N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and Eigen::value.
Referenced by oomph::CRDoubleMatrix::build(), oomph::CRDoubleMatrix::CRDoubleMatrix(), and oomph::CRMatrix< T >::CRMatrix().
void oomph::CRMatrix< T >::build_without_copy | ( | T * | value, |
int * | column_index_, | ||
int * | row_start_, | ||
const unsigned long & | nnz, | ||
const unsigned long & | n, | ||
const unsigned long & | m | ||
) |
Function to build matrix from pointers to arrays which hold the row starts, column indices and non-zero values. The final two arguments are 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!
Function to build a CRMatrix from pointers to arrays which hold the row starts, column indices and non-zero values 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::CRDoubleMatrix::build_without_copy().
void oomph::CRMatrix< T >::clean_up_memory |
Wipe matrix data and set all values to 0.
////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
References N.
Referenced by oomph::CRDoubleMatrix::build(), oomph::CRDoubleMatrix::build_without_copy(), and oomph::CRDoubleMatrix::clear().
|
inline |
Access to C-style column index array.
References oomph::CRMatrix< T >::Column_index.
Referenced by oomph::CRDoubleMatrix::column_index(), oomph::CRMatrix< T >::CRMatrix(), oomph::CRDoubleMatrix::matrix_reduction(), oomph::CRDoubleMatrix::multiply(), and oomph::CRDoubleMatrix::multiply_transpose().
|
inline |
Access to C-style column index array (const version)
References oomph::CRMatrix< T >::Column_index.
|
inline |
The read-write access function 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::CRMatrix< T >::Column_index, i, j, k, oomph::Matrix< T, MATRIX_TYPE >::range_check(), oomph::CRMatrix< T >::Row_start, oomph::SparseMatrix< T, CRMatrix< T > >::Value, and oomph::SparseMatrix< T, CRMatrix< T > >::Zero.
Referenced by oomph::CRDoubleMatrix::diagonal_entries(), and oomph::CRDoubleMatrix::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, CRMatrix< T > >.
References oomph::SparseMatrix< T, CRMatrix< T > >::N, and oomph::Matrix< T, MATRIX_TYPE >::operator()().
Referenced by oomph::CRDoubleMatrix::output_bottom_right_zero_helper().
|
inline |
Access to C-style row_start array.
References oomph::CRMatrix< T >::Row_start.
Referenced by oomph::CRMatrix< T >::CRMatrix(), oomph::CRDoubleMatrix::inf_norm(), oomph::CRDoubleMatrix::matrix_reduction(), oomph::CRDoubleMatrix::multiply(), oomph::CRDoubleMatrix::multiply_transpose(), and oomph::CRDoubleMatrix::row_start().
|
inline |
Access to C-style row_start array (const version)
References oomph::CRMatrix< T >::Row_start.
|
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, CRMatrix< T > >.
References oomph::CRMatrix< T >::Column_index, i, j, oomph::SparseMatrix< T, CRMatrix< T > >::N, oomph::CRMatrix< T >::Row_start, and oomph::SparseMatrix< T, CRMatrix< T > >::Value.
Referenced by oomph::CRDoubleMatrix::sparse_indexed_output_helper().
|
protected |
|
protected |
Start index for row.
Referenced by oomph::CRMatrix< T >::CRMatrix(), oomph::CRMatrix< T >::get_entry(), oomph::CRMatrix< T >::row_start(), oomph::CRMatrix< T >::sparse_indexed_output_helper(), and oomph::CRMatrix< T >::~CRMatrix().