Public Member Functions | Protected Attributes | Private Attributes | List of all members
oomph::CCComplexMatrix Class Reference

A class for compressed column matrices that store doubles. More...

#include <complex_matrices.h>

+ Inheritance diagram for oomph::CCComplexMatrix:

Public Member Functions

 CCComplexMatrix ()
 Default constructor. More...
 
 CCComplexMatrix (const Vector< std::complex< double > > &value, const Vector< int > &row_index, const Vector< int > &column_start, const unsigned long &n, const unsigned long &m)
 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. More...
 
 CCComplexMatrix (const CCComplexMatrix &matrix)
 Broken copy constructor. More...
 
void operator= (const CCComplexMatrix &)
 Broken assignment operator. More...
 
virtual ~CCComplexMatrix ()
 Destructor: Kill the LU factors if they have been setup. More...
 
void enable_doc_stats ()
 Set flag to indicate that stats are to be displayed during solution of linear system with SuperLU. More...
 
void disable_doc_stats ()
 the solve 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...
 
std::complex< double > operator() (const unsigned long &i, const unsigned long &j) const
 Overload the round-bracket access operator to provide read-only (const) access to the data. More...
 
int ludecompose ()
 LU decomposition using SuperLU. More...
 
void lubksub (Vector< std::complex< double > > &rhs)
 LU back solve for given RHS. More...
 
void clean_up_memory ()
 LU clean up (perhaps this should happen in the destructor) More...
 
void residual (const Vector< std::complex< double > > &x, const Vector< std::complex< double > > &b, Vector< std::complex< double > > &residual)
 Find the residulal to x of Ax=b, ie r=b-Ax. More...
 
void multiply (const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
 Multiply the matrix by the vector x: soln=Ax. More...
 
void multiply_transpose (const Vector< std::complex< double > > &x, Vector< std::complex< double > > &soln)
 Multiply the transposed matrix by the vector x: soln=A^T x. More...
 
- Public Member Functions inherited from oomph::ComplexMatrixBase
 ComplexMatrixBase ()
 (Empty) constructor. More...
 
 ComplexMatrixBase (const ComplexMatrixBase &matrix)
 Broken copy constructor. More...
 
void operator= (const ComplexMatrixBase &)
 Broken assignment operator. More...
 
virtual ~ComplexMatrixBase ()
 virtual (empty) destructor More...
 
virtual void solve (Vector< std::complex< double > > &rhs)
 Complete LU solve (replaces matrix by its LU decomposition and overwrites RHS with solution). The default should not need to be over-written. More...
 
virtual void solve (const Vector< std::complex< double > > &rhs, Vector< std::complex< double > > &soln)
 Complete LU solve (Nothing gets overwritten!). The default should not need to be overwritten. More...
 
virtual double max_residual (const Vector< std::complex< double > > &x, const Vector< std::complex< double > > &rhs)
 Find the maximum residual r=b-Ax – generic version, can be overloaded for specific derived classes where the max. can be determined "on the fly". More...
 
- Public Member Functions inherited from oomph::CCMatrix< std::complex< double > >
 CCMatrix ()
 Default constructor. More...
 
 CCMatrix (const Vector< std::complex< double > > &value, const Vector< int > &row_index_, const Vector< int > &column_start_, const unsigned long &n, const unsigned long &m)
 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. More...
 
 CCMatrix (const CCMatrix &source_matrix)
 Copy constructor. More...
 
void operator= (const CCMatrix &)
 Broken assignment operator. More...
 
virtual ~CCMatrix ()
 Destructor, delete any allocated memory. More...
 
std::complex< double > get_entry (const unsigned long &i, const unsigned long &j) const
 Access function that will be called by the read-only round-bracket operator (const) More...
 
std::complex< double > & 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
 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_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...
 
void clean_up_memory ()
 Wipe matrix data and set all values to 0. More...
 
void build (const Vector< std::complex< double > > &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. More...
 
void build_without_copy (std::complex< double > *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! More...
 
- Public Member Functions inherited from oomph::SparseMatrix< std::complex< double >, CCMatrix< std::complex< double > > >
 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...
 
std::complex< double > * value ()
 Access to C-style value array. More...
 
const std::complex< double > * 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...
 
- Public Member Functions inherited from oomph::Matrix< std::complex< double >, CCMatrix< std::complex< double > > >
 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...
 
std::complex< double > 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...
 
std::complex< double > & 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

bool Doc_stats_during_solve
 Flag to indicate if stats are to be displayed during solution of linear system with SuperLU. More...
 
- Protected Attributes inherited from oomph::CCMatrix< std::complex< double > >
int * Row_index
 Row index. More...
 
int * Column_start
 Start index for column. More...
 
- Protected Attributes inherited from oomph::SparseMatrix< std::complex< double >, CCMatrix< std::complex< double > > >
std::complex< double > * 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...
 

Private Attributes

void * F_factors
 Storage for the LU factors as required by SuperLU. More...
 
int Info
 Info flag for the SuperLU solver. More...
 

Additional Inherited Members

- Protected Member Functions inherited from oomph::Matrix< std::complex< double >, CCMatrix< std::complex< double > > >
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...
 
- Static Protected Attributes inherited from oomph::SparseMatrix< std::complex< double >, CCMatrix< std::complex< double > > >
static std::complex< double > Zero
 Dummy zero. More...
 

Detailed Description

A class for compressed column matrices that store doubles.

Definition at line 387 of file complex_matrices.h.

Constructor & Destructor Documentation

oomph::CCComplexMatrix::CCComplexMatrix ( )
inline

Default constructor.

Definition at line 407 of file complex_matrices.h.

References Doc_stats_during_solve.

oomph::CCComplexMatrix::CCComplexMatrix ( const Vector< std::complex< double > > &  value,
const Vector< int > &  row_index,
const Vector< int > &  column_start,
const unsigned long &  n,
const unsigned long &  m 
)
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.

Definition at line 418 of file complex_matrices.h.

References Doc_stats_during_solve.

oomph::CCComplexMatrix::CCComplexMatrix ( const CCComplexMatrix matrix)
inline

Broken copy constructor.

Definition at line 431 of file complex_matrices.h.

References oomph::BrokenCopy::broken_copy().

virtual oomph::CCComplexMatrix::~CCComplexMatrix ( )
inlinevirtual

Destructor: Kill the LU factors if they have been setup.

Definition at line 443 of file complex_matrices.h.

References clean_up_memory().

Member Function Documentation

void oomph::CCComplexMatrix::clean_up_memory ( )
void oomph::CCComplexMatrix::disable_doc_stats ( )
inline

the solve

Definition at line 451 of file complex_matrices.h.

References Doc_stats_during_solve.

void oomph::CCComplexMatrix::enable_doc_stats ( )
inline

Set flag to indicate that stats are to be displayed during solution of linear system with SuperLU.

Definition at line 447 of file complex_matrices.h.

References Doc_stats_during_solve.

void oomph::CCComplexMatrix::lubksub ( Vector< std::complex< double > > &  rhs)
virtual
int oomph::CCComplexMatrix::ludecompose ( )
virtual
void oomph::CCComplexMatrix::multiply ( const Vector< std::complex< double > > &  x,
Vector< std::complex< double > > &  soln 
)
virtual
void oomph::CCComplexMatrix::multiply_transpose ( const Vector< std::complex< double > > &  x,
Vector< std::complex< double > > &  soln 
)
virtual
unsigned long oomph::CCComplexMatrix::ncol ( ) const
inlinevirtual

Return the number of columns of the matrix.

Implements oomph::ComplexMatrixBase.

Definition at line 458 of file complex_matrices.h.

unsigned long oomph::CCComplexMatrix::nrow ( ) const
inlinevirtual

Return the number of rows of the matrix.

Implements oomph::ComplexMatrixBase.

Definition at line 454 of file complex_matrices.h.

std::complex<double> oomph::CCComplexMatrix::operator() ( const unsigned long &  i,
const unsigned long &  j 
) const
inlinevirtual

Overload the round-bracket access operator to provide read-only (const) access to the data.

Implements oomph::ComplexMatrixBase.

Definition at line 463 of file complex_matrices.h.

References oomph::CCMatrix< std::complex< double > >::get_entry().

void oomph::CCComplexMatrix::operator= ( const CCComplexMatrix )
inline

Broken assignment operator.

Definition at line 437 of file complex_matrices.h.

References oomph::BrokenCopy::broken_assign().

void oomph::CCComplexMatrix::residual ( const Vector< std::complex< double > > &  x,
const Vector< std::complex< double > > &  b,
Vector< std::complex< double > > &  residual 
)
virtual

Member Data Documentation

bool oomph::CCComplexMatrix::Doc_stats_during_solve
protected

Flag to indicate if stats are to be displayed during solution of linear system with SuperLU.

Definition at line 402 of file complex_matrices.h.

Referenced by CCComplexMatrix(), clean_up_memory(), disable_doc_stats(), enable_doc_stats(), lubksub(), and ludecompose().

void* oomph::CCComplexMatrix::F_factors
private

Storage for the LU factors as required by SuperLU.

Definition at line 393 of file complex_matrices.h.

Referenced by clean_up_memory(), lubksub(), and ludecompose().

int oomph::CCComplexMatrix::Info
private

Info flag for the SuperLU solver.

Definition at line 396 of file complex_matrices.h.

Referenced by clean_up_memory(), lubksub(), and ludecompose().


The documentation for this class was generated from the following files: