![]() |
|
#include <matrices.h>
Public Member Functions | |
DenseDoubleMatrix () | |
Constructor, set the default linear solver. More... | |
DenseDoubleMatrix (const unsigned long &n) | |
Constructor to build a square n by n matrix. More... | |
DenseDoubleMatrix (const unsigned long &n, const unsigned long &m) | |
Constructor to build a matrix with n rows and m columns. More... | |
DenseDoubleMatrix (const unsigned long &n, const unsigned long &m, const double &initial_val) | |
DenseDoubleMatrix (const DenseDoubleMatrix &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DenseDoubleMatrix &)=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... | |
double | operator() (const unsigned long &i, const unsigned long &j) const |
double & | operator() (const unsigned long &i, const unsigned long &j) |
virtual | ~DenseDoubleMatrix () |
Destructor. More... | |
virtual void | ludecompose () |
LU decomposition using DenseLU (default linea solver) More... | |
virtual void | lubksub (DoubleVector &rhs) |
LU backsubstitution. More... | |
virtual void | lubksub (Vector< double > &rhs) |
LU backsubstitution. More... | |
void | eigenvalues_by_jacobi (Vector< double > &eigen_val, DenseMatrix< double > &eigen_vect) const |
void | multiply (const DoubleVector &x, DoubleVector &soln) const |
Multiply the matrix by the vector x: soln=Ax. More... | |
void | multiply_transpose (const DoubleVector &x, DoubleVector &soln) const |
Multiply the transposed matrix by the vector x: soln=A^T x. More... | |
void | matrix_reduction (const double &alpha, DenseDoubleMatrix &reduced_matrix) |
void | multiply (const DenseDoubleMatrix &matrix_in, DenseDoubleMatrix &result) |
Function to multiply this matrix by a DenseDoubleMatrix matrix_in. More... | |
![]() | |
DoubleMatrixBase () | |
(Empty) constructor. More... | |
DoubleMatrixBase (const DoubleMatrixBase &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DoubleMatrixBase &)=delete |
Broken assignment operator. More... | |
virtual | ~DoubleMatrixBase () |
virtual (empty) destructor More... | |
LinearSolver *& | linear_solver_pt () |
Return a pointer to the linear solver object. More... | |
LinearSolver *const & | linear_solver_pt () const |
Return a pointer to the linear solver object (const version) More... | |
void | solve (DoubleVector &rhs) |
void | solve (const DoubleVector &rhs, DoubleVector &soln) |
void | solve (Vector< double > &rhs) |
void | solve (const Vector< double > &rhs, Vector< double > &soln) |
virtual void | residual (const DoubleVector &x, const DoubleVector &b, DoubleVector &residual_) |
Find the residual, i.e. r=b-Ax the residual. More... | |
virtual double | max_residual (const DoubleVector &x, const DoubleVector &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 double &initial_val) | |
DenseMatrix & | operator= (const DenseMatrix &source_matrix) |
Copy assignment. More... | |
double & | entry (const unsigned long &i, const unsigned long &j) |
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 double &initial_value) |
void | initialise (const 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 |
Additional Inherited Members | |
![]() | |
void | range_check (const unsigned long &i, const unsigned long &j) const |
![]() | |
LinearSolver * | Linear_solver_pt |
LinearSolver * | Default_linear_solver_pt |
![]() | |
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 doubles, and stored as a DenseMatrix<double>, but with solving functionality inherited from the abstract DoubleMatrix class.
oomph::DenseDoubleMatrix::DenseDoubleMatrix | ( | ) |
Constructor, set the default linear solver.
///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Constructor, set the default linear solver to be the DenseLU solver
References oomph::DoubleMatrixBase::Default_linear_solver_pt, and oomph::DoubleMatrixBase::Linear_solver_pt.
oomph::DenseDoubleMatrix::DenseDoubleMatrix | ( | const unsigned long & | n | ) |
Constructor to build a square n by n matrix.
Constructor to build a square n by n matrix. Set the default linear solver to be DenseLU
References oomph::DoubleMatrixBase::Default_linear_solver_pt, and oomph::DoubleMatrixBase::Linear_solver_pt.
Constructor to build a matrix with n rows and m columns.
Constructor to build a matrix with n rows and m columns. Set the default linear solver to be DenseLU
References oomph::DoubleMatrixBase::Default_linear_solver_pt, and oomph::DoubleMatrixBase::Linear_solver_pt.
oomph::DenseDoubleMatrix::DenseDoubleMatrix | ( | const unsigned long & | n, |
const unsigned long & | m, | ||
const double & | initial_val | ||
) |
Constructor to build a matrix with n rows and m columns, with initial value initial_val
Constructor to build a matrix with n rows and m columns, with initial value initial_val Set the default linear solver to be DenseLU
References oomph::DoubleMatrixBase::Default_linear_solver_pt, and oomph::DoubleMatrixBase::Linear_solver_pt.
|
delete |
Broken copy constructor.
|
virtual |
Destructor.
Destructor delete the default linear solver.
References oomph::DoubleMatrixBase::Default_linear_solver_pt.
void oomph::DenseDoubleMatrix::eigenvalues_by_jacobi | ( | Vector< double > & | eigen_vals, |
DenseMatrix< double > & | eigen_vect | ||
) | const |
Determine eigenvalues and eigenvectors, using Jacobi rotations. Only for symmetric matrices. Nothing gets overwritten!
eigen_vect(i,j)
= j-th component of i-th eigenvector.eigen_val(i)
is the i-th eigenvalue; same ordering as in eigenvectorsDetermine eigenvalues and eigenvectors, using Jacobi rotations. Only for symmetric matrices. Nothing gets overwritten!
eigen_vect(i,j)
= j-th component of i-th eigenvector.eigen_val
[i] is the i-th eigenvalue; same ordering as in eigenvectors References i, j, oomph::DenseMatrix< double >::M, oomph::DenseMatrix< double >::Matrixdata, oomph::DenseMatrix< double >::N, oomph::DenseMatrix< T >::ncol(), oomph::DenseMatrix< T >::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::DenseMatrix< T >::resize().
|
virtual |
LU backsubstitution.
Back substitute an LU decomposed matrix.
References oomph::DoubleMatrixBase::Default_linear_solver_pt.
Referenced by oomph::DGElement::get_inverse_mass_matrix_times_residuals(), oomph::Z2ErrorEstimator::get_recovered_flux_in_patch(), and oomph::VorticitySmoother< ELEMENT >::get_recovered_vorticity_in_patch().
LU backsubstitution.
Back substitute an LU decomposed matrix.
References oomph::DoubleMatrixBase::Default_linear_solver_pt.
|
virtual |
LU decomposition using DenseLU (default linea solver)
LU decompose a matrix, by using the default linear solver (DenseLU)
References oomph::DoubleMatrixBase::Default_linear_solver_pt.
Referenced by oomph::DGElement::get_inverse_mass_matrix_times_residuals(), oomph::Z2ErrorEstimator::get_recovered_flux_in_patch(), oomph::VorticitySmoother< ELEMENT >::get_recovered_vorticity_in_patch(), and oomph::DGElement::pre_compute_mass_matrix().
void oomph::DenseDoubleMatrix::matrix_reduction | ( | const double & | alpha, |
DenseDoubleMatrix & | reduced_matrix | ||
) |
For every row, find the maximum absolute value of the entries in this row. Set all values that are less than alpha times this maximum to zero and return the resulting matrix in reduced_matrix. Note: Diagonal entries are retained regardless of their size.
References alpha, boost::multiprecision::fabs(), i, j, oomph::DenseMatrix< double >::M, oomph::DenseMatrix< double >::Matrixdata, oomph::DenseMatrix< double >::N, and oomph::DenseMatrix< T >::resize().
void oomph::DenseDoubleMatrix::multiply | ( | const DenseDoubleMatrix & | matrix_in, |
DenseDoubleMatrix & | result | ||
) |
Function to multiply this matrix by a DenseDoubleMatrix matrix_in.
Function to multiply this matrix by the DenseDoubleMatrix matrix_in.
References i, j, k, oomph::DenseMatrix< double >::Matrixdata, ncol(), nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::DenseMatrix< T >::resize().
|
virtual |
Multiply the matrix by the vector x: soln=Ax.
Implements oomph::DoubleMatrixBase.
References oomph::DoubleVector::build(), oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, oomph::DoubleVector::initialise(), j, oomph::DenseMatrix< double >::M, oomph::DenseMatrix< double >::Matrixdata, oomph::DenseMatrix< double >::N, ncol(), oomph::DistributableLinearAlgebraObject::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::DoubleVector::values_pt(), and plotDoE::x.
Referenced by main().
|
virtual |
Multiply the transposed matrix by the vector x: soln=A^T x.
Implements oomph::DoubleMatrixBase.
References oomph::DoubleVector::build(), oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, oomph::DoubleVector::initialise(), j, oomph::DenseMatrix< double >::M, oomph::DenseMatrix< double >::Matrixdata, oomph::DenseMatrix< double >::N, oomph::DistributableLinearAlgebraObject::nrow(), nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::DoubleVector::values_pt(), and plotDoE::x.
|
inlinevirtual |
Return the number of columns of the matrix.
Implements oomph::DoubleMatrixBase.
References oomph::DenseMatrix< T >::ncol().
Referenced by main(), and multiply().
|
inlinevirtual |
Return the number of rows of the matrix.
Implements oomph::DoubleMatrixBase.
References oomph::DenseMatrix< T >::nrow().
Referenced by main(), multiply(), and multiply_transpose().
|
inline |
Overload the non-const version of the round-bracket access operator for read-write access
References oomph::DenseMatrix< T >::entry(), i, and j.
|
inlinevirtual |
Overload the const version of the round-bracket access operator for read-only access.
Implements oomph::DoubleMatrixBase.
References oomph::DenseMatrix< T >::get_entry(), i, and j.
|
delete |
Broken assignment operator.