//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// More...
#include <matrices.h>
Public Member Functions | |
DenseMatrix () | |
Empty constructor, simply assign the lengths N and M to 0. More... | |
DenseMatrix (const DenseMatrix &source_matrix) | |
Copy constructor: Deep copy! More... | |
DenseMatrix & | operator= (const DenseMatrix &source_matrix) |
Copy assignment. More... | |
T & | entry (const unsigned long &i, const unsigned long &j) |
The access function that will be called by the read-write round-bracket operator. More... | |
T | get_entry (const unsigned long &i, const unsigned long &j) const |
The access function the will be called by the read-only (const version) round-bracket operator. 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 T &initial_val) | |
Constructor to build a matrix with n rows and m columns, with initial value initial_val. More... | |
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) |
Resize to a square nxn matrix; any values already present will be transfered. More... | |
void | resize (const unsigned long &n, const unsigned long &m) |
Resize to a non-square n x m matrix; any values already present will be transfered. More... | |
void | resize (const unsigned long &n, const unsigned long &m, const T &initial_value) |
Resize to a non-square n x m matrix and initialize the new values to initial_value. More... | |
void | initialise (const T &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 function to print a matrix to the stream outfile as i,j,a(i,j) More... | |
void | indexed_output (std::string filename) const |
Indexed output function to print a matrix to a file as i,j,a(i,j). Specify filename. 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... | |
Public Member Functions inherited from oomph::Matrix< T, DenseMatrix< T > > | |
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 |
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... | |
T & | 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... | |
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 | |
T * | 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... | |
Additional Inherited Members | |
Protected Member Functions inherited from oomph::Matrix< T, DenseMatrix< T > > | |
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... | |
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
Class for dense matrices, storing all the values of the matrix as a pointer to a pointer with assorted output functions inherited from Matrix<T>. The curious recursive template pattern is used here to pass the specific class to the base class so that round bracket access can be inlined.
Definition at line 385 of file matrices.h.
|
inline |
Empty constructor, simply assign the lengths N and M to 0.
Definition at line 399 of file matrices.h.
|
inline |
Copy constructor: Deep copy!
Definition at line 402 of file matrices.h.
References i, oomph::DenseMatrix< T >::M, oomph::DenseMatrix< T >::Matrixdata, oomph::DenseMatrix< T >::N, oomph::DenseMatrix< T >::ncol(), oomph::DenseMatrix< T >::nrow(), and oomph::ElementGeometry::T.
oomph::DenseMatrix< T >::DenseMatrix | ( | const unsigned long & | n | ) |
Constructor to build a square n by n matrix.
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
Constructor to build a square n by n matrix
Definition at line 2906 of file matrices.h.
References oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.
oomph::DenseMatrix< T >::DenseMatrix | ( | const unsigned long & | n, |
const unsigned long & | m | ||
) |
Constructor to build a matrix with n rows and m columns.
Definition at line 2924 of file matrices.h.
References oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.
oomph::DenseMatrix< T >::DenseMatrix | ( | const unsigned long & | n, |
const unsigned long & | m, | ||
const T & | initial_val | ||
) |
Constructor to build a matrix with n rows and m columns, with initial value initial_val.
Definition at line 2941 of file matrices.h.
References oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.
|
inlinevirtual |
Destructor, clean up the matrix data.
Definition at line 478 of file matrices.h.
References oomph::DenseMatrix< T >::Matrixdata.
|
inline |
The access function that will be called by the read-write round-bracket operator.
Definition at line 447 of file matrices.h.
References i, oomph::DenseMatrix< T >::M, oomph::DenseMatrix< T >::Matrixdata, and oomph::Matrix< T, DenseMatrix< T > >::range_check().
Referenced by oomph::DenseDoubleMatrix::operator()().
|
inline |
The access function the will be called by the read-only (const version) round-bracket operator.
Definition at line 457 of file matrices.h.
References i, oomph::DenseMatrix< T >::M, oomph::DenseMatrix< T >::Matrixdata, and oomph::Matrix< T, DenseMatrix< T > >::range_check().
Referenced by oomph::DenseDoubleMatrix::operator()().
void oomph::DenseMatrix< T >::indexed_output | ( | std::ostream & | outfile | ) | const |
Indexed output function to print a matrix to the stream outfile as i,j,a(i,j)
Indexed output as i,j,a(i,j)
Definition at line 3089 of file matrices.h.
References i, and oomph::QuadTreeNames::N.
void oomph::DenseMatrix< T >::indexed_output | ( | std::string | filename | ) | const |
Indexed output function to print a matrix to a file as i,j,a(i,j). Specify filename.
Definition at line 3108 of file matrices.h.
|
inline |
Initialize all values in the matrix to val.
Definition at line 514 of file matrices.h.
References i, oomph::DenseMatrix< T >::M, oomph::DenseMatrix< T >::Matrixdata, and oomph::DenseMatrix< T >::N.
Referenced by oomph::PeriodicOrbitTemporalMesh< ELEMENT >::assemble_residuals_and_jacobian(), oomph::FSIHermiteBeamElement::dposition_dlagrangian_at_local_coordinate(), oomph::FSIDiagHermiteShellElement::dposition_dlagrangian_at_local_coordinate(), oomph::GeneralisedElement::get_djacobian_and_dmass_matrix_dparameter(), oomph::GeneralisedElement::get_djacobian_dparameter(), oomph::GeneralisedElement::get_hessian_vector_products(), oomph::PeriodicOrbitBaseElement::get_inner_product_matrix(), oomph::DGElement::get_inverse_mass_matrix_times_residuals(), oomph::Problem::get_jacobian(), oomph::GeneralisedElement::get_jacobian(), oomph::GeneralisedElement::get_jacobian_and_mass_matrix(), oomph::GeneralisedElement::get_mass_matrix(), oomph::PseudoBucklingRingElement::get_residuals_generic(), oomph::SpaceTimeNavierStokesEquations< DIM >::get_vorticity(), oomph::SpaceTimeNavierStokesMixedOrderEquations< DIM >::get_vorticity(), oomph::TimeStepper::make_steady(), oomph::DGElement::pre_compute_mass_matrix(), oomph::SpaceTimeNavierStokesEquations< DIM >::strain_rate(), and oomph::SpaceTimeNavierStokesMixedOrderEquations< DIM >::strain_rate().
|
inlinevirtual |
Return the number of columns of the matrix.
Implements oomph::Matrix< T, DenseMatrix< T > >.
Definition at line 491 of file matrices.h.
References oomph::DenseMatrix< T >::M.
Referenced by oomph::ConstitutiveLaw::are_matrices_of_equal_dimensions(), oomph::ConstitutiveLaw::calculate_contravariant(), oomph::ConstitutiveLaw::calculate_d_contravariant_dG(), oomph::ConstitutiveLaw::calculate_d_second_piola_kirchhoff_stress_dG(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::CRDoubleMatrixHelpers::concatenate(), oomph::CRDoubleMatrixHelpers::concatenate_without_communication(), oomph::DenseMatrix< T >::DenseMatrix(), oomph::FiniteElement::dJ_eulerian_dnodal_coordinates(), oomph::DenseDoubleMatrix::eigenvalues_by_jacobi(), oomph::GeneralisedNewtonianAxisymmetricNavierStokesEquations::extrapolated_strain_rate(), oomph::GeneralisedNewtonianNavierStokesEquations< DIM >::extrapolated_strain_rate(), oomph::CRDoubleMatrixHelpers::gershgorin_eigenvalue_estimate(), oomph::BlockPreconditioner< MATRIX >::get_blocks(), oomph::LinearElasticityEquationsBase< DIM >::get_strain(), oomph::PoroelasticityEquations< DIM >::get_strain(), oomph::PVDEquationsBase< DIM >::get_strain(), oomph::LinearElasticityEquations< DIM >::get_stress(), oomph::PoroelasticityEquations< DIM >::get_stress(), oomph::CRDoubleMatrixHelpers::inf_norm(), oomph::ConstitutiveLaw::is_matrix_square(), oomph::DenseDoubleMatrix::ncol(), oomph::TimeStepper::ntstorage(), oomph::DenseMatrix< T >::operator=(), oomph::LagrangeEnforcedFlowPreconditioner::setup(), oomph::AxisymmetricNavierStokesEquations::strain_rate(), oomph::GeneralisedNewtonianAxisymmetricNavierStokesEquations::strain_rate(), oomph::GeneralisedNewtonianNavierStokesEquations< DIM >::strain_rate(), oomph::LinearisedAxisymmetricNavierStokesEquations::strain_rate(), oomph::NavierStokesEquations< DIM >::strain_rate(), oomph::PolarNavierStokesEquations::strain_rate(), oomph::SpaceTimeNavierStokesEquations< DIM >::strain_rate(), oomph::SpaceTimeNavierStokesMixedOrderEquations< DIM >::strain_rate(), oomph::LinearisedNavierStokesEquations::strain_rate(), and oomph::PolarNavierStokesEquations::strain_rate_by_r().
|
inlinevirtual |
Return the number of rows of the matrix.
Implements oomph::Matrix< T, DenseMatrix< T > >.
Definition at line 485 of file matrices.h.
References oomph::DenseMatrix< T >::N.
Referenced by oomph::ConstitutiveLaw::are_matrices_of_equal_dimensions(), oomph::HelmholtzMGPreconditioner< DIM >::block_preconditioner_self_test(), oomph::GeneralisedHookean::calculate_second_piola_kirchhoff_stress(), oomph::IsotropicStrainEnergyFunctionConstitutiveLaw::calculate_second_piola_kirchhoff_stress(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::CRDoubleMatrixHelpers::concatenate(), oomph::CRDoubleMatrixHelpers::concatenate_without_communication(), oomph::DenseMatrix< T >::DenseMatrix(), oomph::FiniteElement::dJ_eulerian_dnodal_coordinates(), oomph::DenseDoubleMatrix::eigenvalues_by_jacobi(), oomph::GeneralisedNewtonianAxisymmetricNavierStokesEquations::extrapolated_strain_rate(), oomph::GeneralisedNewtonianNavierStokesEquations< DIM >::extrapolated_strain_rate(), oomph::AxisymmetricNavierStokesEquations::fill_in_contribution_to_hessian_vector_products(), oomph::GeneralisedNewtonianAxisymmetricNavierStokesEquations::fill_in_contribution_to_hessian_vector_products(), oomph::DisplacementBasedFoepplvonKarmanEquations::fill_in_contribution_to_jacobian_and_mass_matrix(), oomph::CRDoubleMatrixHelpers::gershgorin_eigenvalue_estimate(), oomph::BlockPreconditioner< MATRIX >::get_blocks(), oomph::LinearElasticityEquationsBase< DIM >::get_strain(), oomph::PoroelasticityEquations< DIM >::get_strain(), oomph::PVDEquationsBase< DIM >::get_strain(), oomph::LinearElasticityEquations< DIM >::get_stress(), oomph::PoroelasticityEquations< DIM >::get_stress(), oomph::TimeStepper::highest_derivative(), oomph::CRDoubleMatrixHelpers::inf_norm(), oomph::ConstitutiveLaw::is_matrix_square(), oomph::DenseDoubleMatrix::nrow(), oomph::DenseMatrix< T >::operator=(), oomph::SecondInvariantHelper::second_invariant(), oomph::LagrangeEnforcedFlowPreconditioner::setup(), oomph::AxisymmetricNavierStokesEquations::strain_rate(), oomph::GeneralisedNewtonianAxisymmetricNavierStokesEquations::strain_rate(), oomph::GeneralisedNewtonianNavierStokesEquations< DIM >::strain_rate(), oomph::LinearisedAxisymmetricNavierStokesEquations::strain_rate(), oomph::NavierStokesEquations< DIM >::strain_rate(), oomph::PolarNavierStokesEquations::strain_rate(), oomph::SpaceTimeNavierStokesEquations< DIM >::strain_rate(), oomph::SpaceTimeNavierStokesMixedOrderEquations< DIM >::strain_rate(), oomph::LinearisedNavierStokesEquations::strain_rate(), and oomph::PolarNavierStokesEquations::strain_rate_by_r().
|
inline |
Copy assignment.
Definition at line 420 of file matrices.h.
References i, oomph::DenseMatrix< T >::M, oomph::DenseMatrix< T >::N, oomph::DenseMatrix< T >::ncol(), oomph::DenseMatrix< T >::nrow(), and oomph::DenseMatrix< T >::resize().
|
virtual |
Output function to print a matrix row-by-row to the stream outfile.
Reimplemented from oomph::Matrix< T, DenseMatrix< T > >.
Definition at line 3054 of file matrices.h.
References i, and oomph::QuadTreeNames::N.
void oomph::DenseMatrix< T >::output | ( | std::string | filename | ) | const |
Output function to print a matrix row-by-row to a file. Specify filename.
Definition at line 3074 of file matrices.h.
References oomph::CommandLineArgs::output().
|
virtual |
Output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python).
Implements oomph::Matrix< T, DenseMatrix< T > >.
Definition at line 3124 of file matrices.h.
References oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.
|
inline |
Resize to a square nxn matrix; any values already present will be transfered.
Definition at line 498 of file matrices.h.
Referenced by oomph::SpectralElement::assign_all_generic_local_eqn_numbers(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::DenseDoubleMatrix::eigenvalues_by_jacobi(), oomph::PeriodicOrbitEquations::fill_in_generic_residual_contribution_orbit(), oomph::RefineableNavierStokesBoussinesqElement< NST_ELEMENT, AD_ELEMENT >::get_dbody_force_nst_dexternal_element_data(), oomph::NavierStokesBoussinesqElement< NST_ELEMENT, AD_ELEMENT >::get_dbody_force_nst_dexternal_element_data(), oomph::Problem::get_fd_jacobian(), oomph::DGElement::get_inverse_mass_matrix_times_residuals(), oomph::Problem::get_jacobian(), oomph::IMRBase::IMRBase(), oomph::KirchhoffLoveShellEquations::KirchhoffLoveShellEquations(), oomph::DenseDoubleMatrix::matrix_reduction(), oomph::ContinuationStorageScheme::modify_storage(), oomph::DenseDoubleMatrix::multiply(), oomph::DenseMatrix< T >::operator=(), oomph::DGElement::pre_compute_mass_matrix(), oomph::BinaryTree::setup_static_data(), oomph::OcTree::setup_static_data(), oomph::QuadTree::setup_static_data(), oomph::HSL_MA42::solve(), and oomph::TimeStepper::TimeStepper().
void oomph::DenseMatrix< T >::resize | ( | const unsigned long & | n, |
const unsigned long & | m | ||
) |
Resize to a non-square n x m matrix; any values already present will be transfered.
Resize to a non-square n_row x m_col matrix, where any values already present will be transfered.
Definition at line 2959 of file matrices.h.
References i, oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.
void oomph::DenseMatrix< T >::resize | ( | const unsigned long & | n, |
const unsigned long & | m, | ||
const T & | initial_value | ||
) |
Resize to a non-square n x m matrix and initialize the new values to initial_value.
Resize to a non-square n_row x m_col matrix and initialize the new entries to specified value.
Definition at line 3008 of file matrices.h.
References i, oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.
|
virtual |
Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only.
Sparse indexed output as i,j,a(i,j) for a(i,j)!=0 only.
Implements oomph::Matrix< T, DenseMatrix< T > >.
Definition at line 3143 of file matrices.h.
References i, oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.
|
protected |
Number of columns.
Definition at line 395 of file matrices.h.
Referenced by oomph::DenseMatrix< T >::DenseMatrix(), oomph::DenseMatrix< T >::entry(), oomph::DenseMatrix< T >::get_entry(), oomph::DenseMatrix< T >::initialise(), oomph::DenseMatrix< T >::ncol(), and oomph::DenseMatrix< T >::operator=().
|
protected |
Internal representation of matrix as a pointer to data.
Definition at line 389 of file matrices.h.
Referenced by oomph::DenseMatrix< T >::DenseMatrix(), oomph::DenseMatrix< T >::entry(), oomph::DenseMatrix< T >::get_entry(), oomph::DenseMatrix< T >::initialise(), and oomph::DenseMatrix< T >::~DenseMatrix().
|
protected |
Number of rows.
Definition at line 392 of file matrices.h.
Referenced by oomph::DenseMatrix< T >::DenseMatrix(), oomph::DenseMatrix< T >::initialise(), oomph::DenseMatrix< T >::nrow(), and oomph::DenseMatrix< T >::operator=().