![]() |
|
#include <complex_matrices.h>
Public Member Functions | |
DenseComplexMatrix () | |
Empty constructor, simply assign the lengths N and M to 0. More... | |
DenseComplexMatrix (const unsigned long &n) | |
Constructor to build a square n by n matrix. More... | |
DenseComplexMatrix (const unsigned long &n, const unsigned long &m) | |
Constructor to build a matrix with n rows and m columns. More... | |
DenseComplexMatrix (const unsigned long &n, const unsigned long &m, const std::complex< double > &initial_val) | |
DenseComplexMatrix (const DenseComplexMatrix &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DenseComplexMatrix &)=delete |
Broken assignment operator. 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 |
std::complex< double > & | operator() (const unsigned long &i, const unsigned long &j) |
virtual | ~DenseComplexMatrix () |
Destructor, delete the storage for Index vector and LU storage (if any) More... | |
int | ludecompose () |
void | lubksub (Vector< std::complex< double >> &rhs) |
Back substitute an LU decomposed matrix. More... | |
void | residual (const Vector< std::complex< double >> &x, const Vector< std::complex< double >> &rhs, Vector< std::complex< double >> &residual) |
Find the residual of Ax=b, i.e. 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... | |
![]() | |
ComplexMatrixBase () | |
(Empty) constructor. More... | |
ComplexMatrixBase (const ComplexMatrixBase &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const ComplexMatrixBase &)=delete |
Broken assignment operator. More... | |
virtual | ~ComplexMatrixBase () |
virtual (empty) destructor More... | |
virtual void | solve (Vector< std::complex< double >> &rhs) |
virtual void | solve (const Vector< std::complex< double >> &rhs, Vector< std::complex< double >> &soln) |
virtual double | max_residual (const Vector< std::complex< double >> &x, const Vector< std::complex< double >> &rhs) |
![]() | |
DenseMatrix () | |
Empty constructor, simply assign the lengths N and M to 0. More... | |
DenseMatrix (const DenseMatrix &source_matrix) | |
Copy constructor: Deep copy! More... | |
DenseMatrix (const unsigned long &n) | |
Constructor to build a square n by n matrix. More... | |
DenseMatrix (const unsigned long &n, const unsigned long &m) | |
Constructor to build a matrix with n rows and m columns. More... | |
DenseMatrix (const unsigned long &n, const unsigned long &m, const std::complex< double > &initial_val) | |
DenseMatrix & | operator= (const DenseMatrix &source_matrix) |
Copy assignment. More... | |
std::complex< double > & | entry (const unsigned long &i, const unsigned long &j) |
std::complex< double > | get_entry (const unsigned long &i, const unsigned long &j) const |
virtual | ~DenseMatrix () |
Destructor, clean up the matrix data. 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... | |
void | resize (const unsigned long &n) |
void | resize (const unsigned long &n, const unsigned long &m) |
void | resize (const unsigned long &n, const unsigned long &m, const std::complex< double > &initial_value) |
void | initialise (const std::complex< double > &val) |
Initialize all values in the matrix to val. More... | |
void | output (std::ostream &outfile) const |
Output function to print a matrix row-by-row to the stream outfile. More... | |
void | output (std::string filename) const |
Output function to print a matrix row-by-row to a file. Specify filename. More... | |
void | indexed_output (std::ostream &outfile) const |
Indexed output as i,j,a(i,j) More... | |
void | indexed_output (std::string filename) const |
void | output_bottom_right_zero_helper (std::ostream &outfile) const |
void | sparse_indexed_output_helper (std::ostream &outfile) const |
Sparse indexed output as i,j,a(i,j) for a(i,j)!=0 only. 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) |
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 |
Private Member Functions | |
void | delete_lu_factors () |
Private Attributes | |
Vector< long > * | Index |
Pointer to storage for the index of permutations in the LU solve. More... | |
std::complex< double > * | LU_factors |
Pointer to storage for the LU decomposition. More... | |
bool | Overwrite_matrix_storage |
Additional Inherited Members | |
![]() | |
void | range_check (const unsigned long &i, const unsigned long &j) const |
![]() | |
std::complex< double > * | Matrixdata |
Internal representation of matrix as a pointer to data. More... | |
unsigned long | N |
Number of rows. More... | |
unsigned long | M |
Number of columns. More... | |
Class of matrices containing double complex, and stored as a DenseMatrix<complex<double> >, but with solving functionality inherited from the abstract ComplexMatrix class.
|
inline |
Empty constructor, simply assign the lengths N and M to 0.
|
inline |
Constructor to build a square n by n matrix.
|
inline |
Constructor to build a matrix with n rows and m columns.
|
inline |
Constructor to build a matrix with n rows and m columns, with initial value initial_val
|
delete |
Broken copy constructor.
|
virtual |
Destructor, delete the storage for Index vector and LU storage (if any)
Destructor clean up the LU factors that have been allocated.
References Index, and LU_factors.
|
private |
Function that deletes the storage for the LU_factors, if it is not the same as the matrix storage
Delete the storage that has been allocated for the LU factors, if the matrix data is not itself being overwritten.
References LU_factors, and Overwrite_matrix_storage.
Referenced by ludecompose().
Back substitute an LU decomposed matrix.
Overload the LU back substitution. Note that the rhs will be overwritten with the solution vector
Reimplemented from oomph::ComplexMatrixBase.
References i, Index, j, LU_factors, oomph::DenseMatrix< std::complex< double > >::N, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
virtual |
Overload the LU decomposition. For this storage scheme the matrix storage will be over-writeen by its LU decomposition
LU decompose a matrix, over-writing it and recording the pivots numbers in the Index vector. Returns the sign of the determinant.
Reimplemented from oomph::ComplexMatrixBase.
References abs(), delete_lu_factors(), oomph::DenseMatrix< std::complex< double > >::entry(), i, imag(), Index, j, k, helpers::lower(), LU_factors, oomph::DenseMatrix< std::complex< double > >::M, oomph::DenseMatrix< std::complex< double > >::Matrixdata, oomph::DenseMatrix< std::complex< double > >::N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Overwrite_matrix_storage, SYCL::sign(), and tmp.
|
virtual |
Multiply the matrix by the vector x: soln=Ax.
Implements oomph::ComplexMatrixBase.
References i, j, oomph::DenseMatrix< std::complex< double > >::M, oomph::DenseMatrix< std::complex< double > >::Matrixdata, oomph::DenseMatrix< std::complex< double > >::N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and plotDoE::x.
|
virtual |
Multiply the transposed matrix by the vector x: soln=A^T x.
Implements oomph::ComplexMatrixBase.
References i, j, oomph::DenseMatrix< std::complex< double > >::M, oomph::DenseMatrix< std::complex< double > >::Matrixdata, oomph::DenseMatrix< std::complex< double > >::N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and plotDoE::x.
|
inlinevirtual |
Return the number of columns of the matrix.
Implements oomph::ComplexMatrixBase.
|
inlinevirtual |
Return the number of rows of the matrix.
Implements oomph::ComplexMatrixBase.
|
inline |
Overload the non-const version of the round-bracket access operator for read-write access
References oomph::DenseMatrix< std::complex< double > >::entry(), i, and j.
|
inlinevirtual |
Overload the const version of the round-bracket access operator for read-only access.
Implements oomph::ComplexMatrixBase.
References oomph::DenseMatrix< std::complex< double > >::get_entry(), i, and j.
|
delete |
Broken assignment operator.
|
virtual |
Find the residual of Ax=b, i.e. r=b-Ax.
Find the residual of Ax=b, ie r=b-Ax for the "solution" x.
Implements oomph::ComplexMatrixBase.
References i, j, oomph::DenseMatrix< std::complex< double > >::M, oomph::DenseMatrix< std::complex< double > >::Matrixdata, oomph::DenseMatrix< std::complex< double > >::N, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and plotDoE::x.
|
private |
Pointer to storage for the index of permutations in the LU solve.
Referenced by lubksub(), ludecompose(), and ~DenseComplexMatrix().
|
private |
Pointer to storage for the LU decomposition.
Referenced by delete_lu_factors(), lubksub(), ludecompose(), and ~DenseComplexMatrix().
|
private |
Boolean flag used to decided whether the LU decomposition is stored separately, or not
Referenced by delete_lu_factors(), and ludecompose().