![]() |
|
#include <matrices.h>
Classes | |
struct | CRDoubleMatrixComparisonHelper |
Create a struct to provide a comparison function for std::sort. More... | |
Public Member Functions | |
CRDoubleMatrix () | |
Default constructor. More... | |
CRDoubleMatrix (const LinearAlgebraDistribution *distribution_pt, const unsigned &ncol, const Vector< double > &value, const Vector< int > &column_index, const Vector< int > &row_start) | |
CRDoubleMatrix (const LinearAlgebraDistribution *distribution_pt) | |
CRDoubleMatrix (const CRDoubleMatrix &matrix) | |
Copy constructor. More... | |
void | operator= (const CRDoubleMatrix &)=delete |
Broken assignment operator. More... | |
virtual | ~CRDoubleMatrix () |
Destructor. More... | |
const Vector< int > | get_index_of_diagonal_entries () const |
bool | entries_are_sorted (const bool &doc_unordered_entries=false) const |
void | sort_entries () |
void | build (const LinearAlgebraDistribution *distribution_pt, const unsigned &ncol, const Vector< double > &value, const Vector< int > &column_index, const Vector< int > &row_start) |
void | build (const LinearAlgebraDistribution *distribution_pt) |
Rebuild the matrix - assembles an empty matrix with a defined distribution. More... | |
void | build (const unsigned &ncol, const Vector< double > &value, const Vector< int > &column_index, const Vector< int > &row_start) |
keeps the existing distribution and just matrix that is stored More... | |
void | build_without_copy (const unsigned &ncol, const unsigned &nnz, double *value, int *column_index, int *row_start) |
method to rebuild the matrix, but not the distribution More... | |
void | redistribute (const LinearAlgebraDistribution *const &dist_pt) |
void | clear () |
clear 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 | output_bottom_right_zero_helper (std::ostream &outfile) const |
void | sparse_indexed_output_helper (std::ostream &outfile) const |
void | sparse_indexed_output_with_offset (std::string filename) |
double | operator() (const unsigned long &i, const unsigned long &j) const |
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... | |
double * | value () |
Access to C-style value array. More... | |
const double * | value () const |
Access to C-style value array (const version) More... | |
unsigned long | nnz () const |
Return the number of nonzero entries (the local nnz) More... | |
virtual void | ludecompose () |
Do LU decomposition. More... | |
virtual void | lubksub (DoubleVector &rhs) |
LU back solve for given RHS. More... | |
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 | multiply (const CRDoubleMatrix &matrix_in, CRDoubleMatrix &result) const |
void | matrix_reduction (const double &alpha, CRDoubleMatrix &reduced_matrix) |
unsigned & | serial_matrix_matrix_multiply_method () |
const unsigned & | serial_matrix_matrix_multiply_method () const |
unsigned & | distributed_matrix_matrix_multiply_method () |
const unsigned & | distributed_matrix_matrix_multiply_method () const |
bool | built () const |
CRDoubleMatrix * | global_matrix () const |
void | get_matrix_transpose (CRDoubleMatrix *result) const |
Returns the transpose of this matrix. More... | |
double | inf_norm () const |
returns the inf-norm of this matrix More... | |
Vector< double > | diagonal_entries () const |
void | add (const CRDoubleMatrix &matrix_in, CRDoubleMatrix &result_matrix) const |
element-wise addition of this matrix with matrix_in. 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... | |
double | operator() (const unsigned long &i, const unsigned long &j) const |
double & | 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 |
![]() | |
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) |
![]() | |
DistributableLinearAlgebraObject () | |
Default constructor - create a distribution. More... | |
DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DistributableLinearAlgebraObject &)=delete |
Broken assignment operator. More... | |
virtual | ~DistributableLinearAlgebraObject () |
Destructor. More... | |
LinearAlgebraDistribution * | distribution_pt () const |
access to the LinearAlgebraDistribution More... | |
unsigned | nrow () const |
access function to the number of global rows. More... | |
unsigned | nrow_local () const |
access function for the num of local rows on this processor. More... | |
unsigned | nrow_local (const unsigned &p) const |
access function for the num of local rows on this processor. More... | |
unsigned | first_row () const |
access function for the first row on this processor More... | |
unsigned | first_row (const unsigned &p) const |
access function for the first row on this processor More... | |
bool | distributed () const |
distribution is serial or distributed More... | |
bool | distribution_built () const |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
void | build_distribution (const LinearAlgebraDistribution &dist) |
Public Attributes | |
struct oomph::CRDoubleMatrix::CRDoubleMatrixComparisonHelper | Comparison_struct |
Private Attributes | |
Vector< int > | Index_of_diagonal_entries |
unsigned | Serial_matrix_matrix_multiply_method |
unsigned | Distributed_matrix_matrix_multiply_method |
CRMatrix< double > | CR_matrix |
Storage for the Matrix in CR Format. More... | |
bool | Built |
Additional Inherited Members | |
![]() | |
void | range_check (const unsigned long &i, const unsigned long &j) const |
![]() | |
void | clear_distribution () |
![]() | |
LinearSolver * | Linear_solver_pt |
LinearSolver * | Default_linear_solver_pt |
A class for compressed row matrices. This is a distributable object.
oomph::CRDoubleMatrix::CRDoubleMatrix | ( | ) |
Default constructor.
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
References Built, oomph::DoubleMatrixBase::Default_linear_solver_pt, oomph::DoubleMatrixBase::Linear_solver_pt, and Serial_matrix_matrix_multiply_method.
Referenced by global_matrix().
oomph::CRDoubleMatrix::CRDoubleMatrix | ( | const LinearAlgebraDistribution * | dist_pt, |
const unsigned & | ncol, | ||
const Vector< double > & | value, | ||
const Vector< int > & | column_index, | ||
const Vector< int > & | row_start | ||
) |
Constructor: vector of values, vector of column indices, vector of row starts and number of rows and columns.
Constructor: Takes the distribution and the number of columns, as well as the vector of values, vector of column indices,vector of row starts.
References oomph::CRMatrix< T >::build(), oomph::DistributableLinearAlgebraObject::build_distribution(), Built, column_index(), CR_matrix, oomph::DoubleMatrixBase::Default_linear_solver_pt, oomph::DoubleMatrixBase::Linear_solver_pt, ncol(), oomph::LinearAlgebraDistribution::nrow_local(), row_start(), Serial_matrix_matrix_multiply_method, and value().
oomph::CRDoubleMatrix::CRDoubleMatrix | ( | const LinearAlgebraDistribution * | distribution_pt | ) |
Constructor: just stores the distribution but does not build the matrix
References oomph::DistributableLinearAlgebraObject::build_distribution(), Built, oomph::DoubleMatrixBase::Default_linear_solver_pt, oomph::DoubleMatrixBase::Linear_solver_pt, and Serial_matrix_matrix_multiply_method.
oomph::CRDoubleMatrix::CRDoubleMatrix | ( | const CRDoubleMatrix & | matrix | ) |
Copy constructor.
References oomph::DistributableLinearAlgebraObject::build_distribution(), build_without_copy(), Built, column_index(), copy(), oomph::DoubleMatrixBase::Default_linear_solver_pt, oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::DoubleMatrixBase::Linear_solver_pt, ncol(), nnz(), oomph::DistributableLinearAlgebraObject::nrow_local(), row_start(), Serial_matrix_matrix_multiply_method, and value().
|
virtual |
void oomph::CRDoubleMatrix::add | ( | const CRDoubleMatrix & | matrix_in, |
CRDoubleMatrix & | result_matrix | ||
) | const |
element-wise addition of this matrix with matrix_in.
Element-wise addition of this matrix with matrix_in.
References build(), oomph::LinearAlgebraDistribution::built(), built(), column_index(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, ncol(), nrow(), oomph::DistributableLinearAlgebraObject::nrow_local(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, row_start(), and value().
Referenced by main().
void oomph::CRDoubleMatrix::build | ( | const LinearAlgebraDistribution * | distribution_pt | ) |
Rebuild the matrix - assembles an empty matrix with a defined distribution.
rebuild the matrix - assembles an empty matrix will a defined distribution
References oomph::DistributableLinearAlgebraObject::build_distribution(), and clear().
void oomph::CRDoubleMatrix::build | ( | const LinearAlgebraDistribution * | distribution_pt, |
const unsigned & | ncol, | ||
const Vector< double > & | value, | ||
const Vector< int > & | column_index, | ||
const Vector< int > & | row_start | ||
) |
build method: vector of values, vector of column indices, vector of row starts and number of rows and columns.
build method: Takes the distribution and the number of columns, as well as the vector of values, vector of column indices,vector of row starts.
References oomph::DistributableLinearAlgebraObject::build_distribution(), clear(), column_index(), oomph::DoubleMatrixBase::Default_linear_solver_pt, row_start(), and value().
Referenced by add(), oomph::CRDoubleMatrixHelpers::concatenate(), oomph::CRDoubleMatrixHelpers::concatenate_without_communication(), oomph::CRDoubleMatrixHelpers::create_uniformly_distributed_matrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), oomph::Problem::get_eigenproblem_matrices(), oomph::Problem::get_jacobian(), get_matrix_transpose(), oomph::BlockPreconditioner< MATRIX >::internal_get_block(), main(), matrix_reduction(), oomph::TrilinosEpetraHelpers::multiply(), multiply(), redistribute(), oomph::LagrangeEnforcedFlowPreconditioner::setup(), and oomph::HelmholtzMGPreconditioner< DIM >::setup_mg_structures().
void oomph::CRDoubleMatrix::build | ( | const unsigned & | ncol, |
const Vector< double > & | value, | ||
const Vector< int > & | column_index, | ||
const Vector< int > & | row_start | ||
) |
keeps the existing distribution and just matrix that is stored
method to rebuild the matrix, but not the distribution
References oomph::CRMatrix< T >::build(), Built, oomph::CRMatrix< T >::clean_up_memory(), column_index(), CR_matrix, oomph::DistributableLinearAlgebraObject::nrow_local(), row_start(), and value().
void oomph::CRDoubleMatrix::build_without_copy | ( | const unsigned & | ncol, |
const unsigned & | nnz, | ||
double * | value, | ||
int * | column_index, | ||
int * | row_start | ||
) |
method to rebuild the matrix, but not the distribution
keeps the existing distribution and just matrix that is stored without copying the matrix data
References oomph::CRMatrix< T >::build_without_copy(), Built, oomph::CRMatrix< T >::clean_up_memory(), column_index(), CR_matrix, nnz(), oomph::DistributableLinearAlgebraObject::nrow_local(), row_start(), and value().
Referenced by oomph::NavierStokesSchurComplementPreconditioner::assemble_inv_press_and_veloc_mass_matrix_diagonal(), oomph::PressureBasedSolidLSCPreconditioner::assemble_mass_matrix_diagonal(), oomph::CRDoubleMatrixHelpers::concatenate_without_communication(), CRDoubleMatrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), oomph::Problem::get_eigenproblem_matrices(), oomph::Problem::get_jacobian(), global_matrix(), oomph::BlockPreconditioner< MATRIX >::internal_get_block(), oomph::TrilinosEpetraHelpers::multiply(), multiply(), and redistribute().
|
inline |
access function to the Built flag - indicates whether the matrix has been build - i.e. the distribution has been defined and the matrix assembled.
References Built.
Referenced by add(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), oomph::HypreHelpers::create_HYPRE_Matrix(), oomph::CRDoubleMatrixHelpers::create_uniformly_distributed_matrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), diagonal_entries(), oomph::MumpsSolver::factorise(), oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), multiply(), oomph::TrilinosEpetraHelpers::multiply(), oomph::DoubleVector::norm(), and redistribute().
void oomph::CRDoubleMatrix::clear | ( | ) |
clear
Clean method.
References Built, oomph::LinearSolver::clean_up_memory(), oomph::CRMatrix< T >::clean_up_memory(), oomph::DistributableLinearAlgebraObject::clear_distribution(), CR_matrix, and oomph::DoubleMatrixBase::Linear_solver_pt.
Referenced by build(), oomph::MumpsSolver::factorise(), oomph::HypreInterface::hypre_matrix_setup(), main(), oomph::FSIPreconditioner::setup(), and ~CRDoubleMatrix().
|
inline |
Access to C-style column index array.
References oomph::CRMatrix< T >::column_index(), and CR_matrix.
Referenced by add(), build(), build_without_copy(), oomph::CRDoubleMatrixHelpers::concatenate(), CRDoubleMatrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), oomph::HypreHelpers::create_HYPRE_Matrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), entries_are_sorted(), oomph::MumpsSolver::factorise(), oomph::SuperLUSolver::factorise_serial(), get_matrix_transpose(), global_matrix(), oomph::BlockPreconditioner< MATRIX >::internal_get_block(), matrix_reduction(), multiply(), multiply_transpose(), redistribute(), oomph::ILUZeroPreconditioner< CRDoubleMatrix >::setup(), oomph::PseudoElasticPreconditionerSubsidiaryPreconditionerOld::setup(), oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures(), oomph::GS< CRDoubleMatrix >::solve_helper(), sort_entries(), and sparse_indexed_output_with_offset().
|
inline |
Access to C-style column index array (const version)
References oomph::CRMatrix< T >::column_index(), and CR_matrix.
returns a Vector of diagonal entries of this matrix. This only works with square matrices. This condition may be relaxed in the future if need be.
Return the diagonal entries of the matrix. This only works with square matrices. This condition may be relaxed in the future if need be.
References built(), CR_matrix, oomph::DistributableLinearAlgebraObject::first_row(), oomph::CRMatrix< T >::get_entry(), i, ncol(), nrow(), oomph::DistributableLinearAlgebraObject::nrow_local(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup(), and oomph::LagrangeEnforcedFlowPreconditioner::setup().
|
inline |
Access function to Distributed_matrix_matrix_multiply_method, the flag which determines the matrix matrix multiplication method used for distributed matrices. Method 1: Trilinos Epetra Matrix Matrix multiply. Method 2: Trilinos Epetra Matrix Matrix multiply (ML based).
References Distributed_matrix_matrix_multiply_method.
Referenced by oomph::CRDoubleMatrixHelpers::deep_copy().
|
inline |
Read only access function (const version) to Distributed_matrix_matrix_multiply_method, the flag which determines the matrix matrix multiplication method used for distributed matrices. Method 1: Trilinos Epetra Matrix Matrix multiply. Method 2: Trilinos Epetra Matrix Matrix multiply (ML based).
References Distributed_matrix_matrix_multiply_method.
Runs through the column index vector and checks if the entries follow the regular lexicographical ordering of matrix entries, i.e. it will check (at the i-th row of the matrix) if the entries in the column index vector associated with this row are in increasing order
Runs through the column index vector and checks if the entries are arranged arbitrarily or if they follow the regular lexicographical of matrices. If a boolean argument is provided with the assignment TRUE then information on the first entry which is not in the correct position will also be given
References column_index(), oomph::DistributableLinearAlgebraObject::distributed(), i, j, nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, and row_start().
Access function: returns the vector Index_of_diagonal_entries. The i-th entry of the vector contains the index of the last entry below or on the diagonal. If there are no entries below or on the diagonal then the corresponding entry is -1. If, however, there are no entries in the row then the entry is irrelevant and is kept as the initialised value; 0.
References Index_of_diagonal_entries, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().
void oomph::CRDoubleMatrix::get_matrix_transpose | ( | CRDoubleMatrix * | result | ) | const |
Returns the transpose of this matrix.
Compute transpose of matrix.
References a, b, build(), oomph::LinearAlgebraDistribution::build(), calibrate::c, column_index(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, j, ncol(), nnz(), nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, row_start(), and value().
CRDoubleMatrix * oomph::CRDoubleMatrix::global_matrix | ( | ) | const |
if this matrix is distributed then a the equivalent global matrix is built using new and returned. The calling method is responsible for the destruction of the new matrix.
if this matrix is distributed then the equivalent global matrix is built using new and returned. The calling method is responsible for the destruction of the new matrix.
References build_without_copy(), column_index(), oomph::LinearAlgebraDistribution::communicator_pt(), CRDoubleMatrix(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::DistributableLinearAlgebraObject::first_row(), i, j, ncol(), nnz(), oomph::OomphCommunicator::nproc(), nrow(), oomph::DistributableLinearAlgebraObject::nrow_local(), p, row_start(), and value().
Referenced by oomph::ILUZeroPreconditioner< CRDoubleMatrix >::setup().
double oomph::CRDoubleMatrix::inf_norm | ( | ) | const |
returns the inf-norm of this matrix
Compute infinity (maximum) norm of matrix.
References a, CR_matrix, oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_built(), oomph::DistributableLinearAlgebraObject::distribution_pt(), boost::multiprecision::fabs(), i, j, max, n, oomph::DistributableLinearAlgebraObject::nrow_local(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::CRMatrix< T >::row_start(), row_start(), oomph::SparseMatrix< T, MATRIX_TYPE >::value(), and value().
Referenced by oomph::PseudoElasticPreconditionerScalingHelperOld::s_inf_norm().
|
virtual |
LU back solve for given RHS.
Do back-substitution.
References oomph::DoubleVector::built(), oomph::DoubleMatrixBase::Default_linear_solver_pt, oomph::DistributableLinearAlgebraObject::distribution_pt(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
virtual |
Do LU decomposition.
LU decomposition using SuperLU if matrix is not distributed or distributed onto a single processor.
References Built, oomph::DoubleMatrixBase::Default_linear_solver_pt, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
void oomph::CRDoubleMatrix::matrix_reduction | ( | const double & | alpha, |
CRDoubleMatrix & | 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, build(), oomph::CRMatrix< T >::column_index(), column_index(), CR_matrix, boost::multiprecision::fabs(), i, j, k, ncol(), oomph::DistributableLinearAlgebraObject::nrow_local(), oomph::CRMatrix< T >::row_start(), row_start(), oomph::SparseMatrix< T, MATRIX_TYPE >::value(), and value().
void oomph::CRDoubleMatrix::multiply | ( | const CRDoubleMatrix & | matrix_in, |
CRDoubleMatrix & | result | ||
) | const |
Function to multiply this matrix by the CRDoubleMatrix matrix_in. In a serial matrix, there are 4 methods available: Method 1: First runs through this matrix and matrix_in to find the storage requirements for result - arrays of the correct size are then allocated before performing the calculation. Minimises memory requirements but more costly. Method 2: Grows storage for values and column indices of result 'on the fly' using an array of maps. Faster but more memory intensive. Method 3: Grows storage for values and column indices of result 'on the fly' using a vector of vectors. Not particularly impressive on the platforms we tried... Method 4: Trilinos Epetra Matrix Matrix multiply. Method 5: Trilinox Epetra Matrix Matrix Mulitply (ml based) If Trilinos is installed then Method 4 is employed by default, otherwise Method 2 is employed by default. In a distributed matrix, only Trilinos Epetra Matrix Matrix multiply is available.
References build(), build_without_copy(), built(), Built, col(), column_index(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_built(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, oomph::TrilinosEpetraHelpers::multiply(), N, ncol(), nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, row(), row_start(), Serial_matrix_matrix_multiply_method, size, and value().
|
virtual |
Multiply the matrix by the vector x: soln=Ax.
Multiply the matrix by the vector x.
Implements oomph::DoubleMatrixBase.
References oomph::DoubleVector::build(), oomph::DoubleVector::built(), Built, oomph::CRMatrix< T >::column_index(), column_index(), CR_matrix, oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, oomph::DoubleVector::initialise(), j, k, oomph::TrilinosEpetraHelpers::multiply(), n, ncol(), oomph::LinearAlgebraDistribution::nrow(), nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::CRMatrix< T >::row_start(), row_start(), oomph::SparseMatrix< T, MATRIX_TYPE >::value(), value(), oomph::DoubleVector::values_pt(), and plotDoE::x.
Referenced by oomph::ProblemBasedShiftInvertOperator::apply(), oomph::AugmentedProblemGMRES::augmented_matrix_multiply(), main(), oomph::MatrixVectorProduct::multiply(), oomph::DoubleVector::norm(), oomph::GMRESBlockPreconditioner::preconditioner_solve(), oomph::LagrangeEnforcedFlowPreconditioner::setup(), oomph::NavierStokesSchurComplementPreconditioner::setup(), oomph::PressureBasedSolidLSCPreconditioner::setup(), and oomph::SpaceTimeNavierStokesSubsidiaryPreconditioner::setup().
|
virtual |
Multiply the transposed matrix by the vector x: soln=A^T x.
Implements oomph::DoubleMatrixBase.
References oomph::DoubleVector::build(), oomph::DoubleVector::built(), Built, oomph::CRMatrix< T >::column_index(), column_index(), CR_matrix, oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, oomph::DoubleVector::initialise(), j, k, oomph::TrilinosEpetraHelpers::multiply(), n, oomph::LinearAlgebraDistribution::nrow(), nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::CRMatrix< T >::row_start(), row_start(), oomph::SparseMatrix< T, MATRIX_TYPE >::value(), value(), oomph::DoubleVector::values_pt(), and plotDoE::x.
Referenced by oomph::MatrixVectorProduct::multiply_transpose(), oomph::SuperLUSolver::solve(), and oomph::SuperLUSolver::solve_transpose().
|
inlinevirtual |
Return the number of columns of the matrix.
Implements oomph::DoubleMatrixBase.
References CR_matrix, and oomph::SparseMatrix< T, MATRIX_TYPE >::ncol().
Referenced by add(), CRDoubleMatrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), oomph::HypreHelpers::create_HYPRE_Matrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), diagonal_entries(), oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), get_matrix_transpose(), global_matrix(), main(), matrix_reduction(), oomph::TrilinosEpetraHelpers::multiply(), multiply(), redistribute(), oomph::MatrixVectorProduct::setup(), and oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures().
|
inline |
Return the number of nonzero entries (the local nnz)
References CR_matrix, and oomph::SparseMatrix< T, MATRIX_TYPE >::nnz().
Referenced by build_without_copy(), CRDoubleMatrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), oomph::CRDoubleMatrixHelpers::deep_copy(), oomph::MumpsSolver::factorise(), oomph::SuperLUSolver::factorise_serial(), get_matrix_transpose(), global_matrix(), main(), redistribute(), oomph::HyprePreconditioner::setup(), oomph::LagrangeEnforcedFlowPreconditioner::setup(), oomph::BandedBlockTriangularPreconditioner< MATRIX >::setup(), oomph::SpaceTimeNavierStokesSubsidiaryPreconditioner::setup(), oomph::GMRESBlockPreconditioner::setup(), oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures(), oomph::SuperLUSolver::solve(), and oomph::SuperLUSolver::solve_transpose().
|
inlinevirtual |
Return the number of rows of the matrix.
Implements oomph::DoubleMatrixBase.
References oomph::DistributableLinearAlgebraObject::nrow().
Referenced by add(), oomph::AugmentedProblemGMRES::augmented_matrix_multiply(), oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup(), oomph::CRDoubleMatrixHelpers::concatenate(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), oomph::HypreHelpers::create_HYPRE_Matrix(), diagonal_entries(), entries_are_sorted(), oomph::Problem::get_eigenproblem_matrices(), get_matrix_transpose(), global_matrix(), oomph::HypreInterface::hypre_matrix_setup(), main(), oomph::MGSolver< DIM >::modify_restriction_matrices(), oomph::TrilinosEpetraHelpers::multiply(), multiply(), multiply_transpose(), redistribute(), oomph::ILUZeroPreconditioner< CRDoubleMatrix >::setup(), oomph::HyprePreconditioner::setup(), oomph::BandedBlockTriangularPreconditioner< MATRIX >::setup(), oomph::SpaceTimeNavierStokesSubsidiaryPreconditioner::setup(), oomph::GMRESBlockPreconditioner::setup(), oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures(), oomph::SuperLUSolver::solve(), oomph::SuperLUSolver::solve_transpose(), and sort_entries().
|
inlinevirtual |
Overload the round-bracket access operator for read-only access. In a distributed matrix i refers to the local row index.
Implements oomph::DoubleMatrixBase.
References CR_matrix, oomph::CRMatrix< T >::get_entry(), i, and j.
|
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).
Implements oomph::Matrix< double, CRDoubleMatrix >.
References CR_matrix, and oomph::CRMatrix< T >::output_bottom_right_zero_helper().
void oomph::CRDoubleMatrix::redistribute | ( | const LinearAlgebraDistribution *const & | dist_pt | ) |
The contents of the matrix are redistributed to match the new distribution. In a non-MPI build this method does nothing. NOTE 1: The current distribution and the new distribution must have the same number of global rows. NOTE 2: The current distribution and the new distribution must have the same Communicator.
References build(), build_without_copy(), built(), column_index(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearAlgebraDistribution::first_row(), oomph::DistributableLinearAlgebraObject::first_row(), i, j, k, max, min, oomph::OomphCommunicator::my_rank(), ncol(), nnz(), oomph::OomphCommunicator::nproc(), oomph::LinearAlgebraDistribution::nrow(), nrow(), oomph::LinearAlgebraDistribution::nrow_local(), oomph::DistributableLinearAlgebraObject::nrow_local(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, row_start(), and value().
Referenced by oomph::CRDoubleMatrixHelpers::create_uniformly_distributed_matrix(), oomph::Problem::get_eigenproblem_matrices(), and oomph::Problem::get_jacobian().
|
inline |
Access to C-style row_start array.
References CR_matrix, and oomph::CRMatrix< T >::row_start().
Referenced by add(), build(), build_without_copy(), oomph::CRDoubleMatrixHelpers::concatenate(), CRDoubleMatrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), oomph::HypreHelpers::create_HYPRE_Matrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), entries_are_sorted(), oomph::MumpsSolver::factorise(), oomph::SuperLUSolver::factorise_serial(), oomph::CRDoubleMatrixHelpers::gershgorin_eigenvalue_estimate(), get_matrix_transpose(), global_matrix(), inf_norm(), oomph::CRDoubleMatrixHelpers::inf_norm(), oomph::BlockPreconditioner< MATRIX >::internal_get_block(), matrix_reduction(), oomph::MGSolver< DIM >::modify_restriction_matrices(), multiply(), multiply_transpose(), redistribute(), oomph::MatrixBasedLumpedPreconditioner< MATRIX >::setup(), oomph::ILUZeroPreconditioner< CRDoubleMatrix >::setup(), oomph::PseudoElasticPreconditionerSubsidiaryPreconditionerOld::setup(), oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures(), oomph::GS< CRDoubleMatrix >::solve_helper(), sort_entries(), and sparse_indexed_output_with_offset().
|
inline |
Access to C-style row_start array (const version)
References CR_matrix, and oomph::CRMatrix< T >::row_start().
|
inline |
Access function to Serial_matrix_matrix_multiply_method, the flag which determines the matrix matrix multiplication method used for serial matrices. Method 1: First runs through this matrix and matrix_in to find the storage requirements for result - arrays of the correct size are then allocated before performing the calculation. Minimises memory requirements but more costly. Method 2: Grows storage for values and column indices of result 'on the fly' using an array of maps. Faster but more memory intensive. Method 3: Grows storage for values and column indices of result 'on the fly' using a vector of vectors. Not particularly impressive on the platforms we tried... Method 4: Trilinos Epetra Matrix Matrix multiply. Method 5: Trilinos Epetra Matrix Matrix multiply (ML based).
References Serial_matrix_matrix_multiply_method.
Referenced by oomph::CRDoubleMatrixHelpers::deep_copy(), and main().
|
inline |
Read only access function (const version) to Serial_matrix_matrix_multiply_method, the flag which determines the matrix matrix multiplication method used for serial matrices. Method 1: First runs through this matrix and matrix_in to find the storage requirements for result - arrays of the correct size are then allocated before performing the calculation. Minimises memory requirements but more costly. Method 2: Grows storage for values and column indices of result 'on the fly' using an array of maps. Faster but more memory intensive. Method 3: Grows storage for values and column indices of result 'on the fly' using a vector of vectors. Not particularly impressive on the platforms we tried... Method 4: Trilinos Epetra Matrix Matrix multiply. Method 5: Trilinos Epetra Matrix Matrix multiply (ML based).
References Serial_matrix_matrix_multiply_method.
void oomph::CRDoubleMatrix::sort_entries | ( | ) |
Sorts the entries associated with each row of the matrix in the column index vector and the value vector into ascending order and sets up the Index_of_diagonal_entries vector
This helper function sorts the entries in the column index vector and the value vector. During the construction of the matrix the entries were most likely assigned in an arbitrary order. As a result, it cannot be assumed that the entries in the column index vector corresponding to each row of the matrix have been arranged in increasing order. During the setup an additional vector will be set up; Index_of_diagonal_entries. The i-th entry of this vector contains the index of the last entry below or on the diagonal. If there are no entries below or on the diagonal then the corresponding entry is -1. If, however, there are no entries in the row then the entry is irrelevant and is kept as the initialised value; 0.
References column_index(), Comparison_struct, oomph::DistributableLinearAlgebraObject::distributed(), i, Index_of_diagonal_entries, j, nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, row_start(), and value().
|
inlinevirtual |
Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only.
Implements oomph::Matrix< double, CRDoubleMatrix >.
References CR_matrix, and oomph::CRMatrix< T >::sparse_indexed_output_helper().
|
inline |
Indexed output function to print a matrix to a file as i,j,a(i,j) for a(i,j)!=0 only. Specify filename. This uses acual global row numbers.
References column_index(), oomph::DistributableLinearAlgebraObject::distribution_pt(), MergeRestartFiles::filename, oomph::LinearAlgebraDistribution::first_row(), oomph::DistributableLinearAlgebraObject::first_row(), i, j, n, oomph::DistributableLinearAlgebraObject::nrow_local(), row_start(), and value().
Referenced by oomph::SpaceTimeNavierStokesSubsidiaryPreconditioner::setup().
|
inline |
Access to C-style value array.
References CR_matrix, and oomph::SparseMatrix< T, MATRIX_TYPE >::value().
Referenced by add(), build(), build_without_copy(), oomph::CRDoubleMatrixHelpers::concatenate(), CRDoubleMatrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), oomph::HypreHelpers::create_HYPRE_Matrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), oomph::MumpsSolver::factorise(), oomph::SuperLUSolver::factorise_serial(), oomph::CRDoubleMatrixHelpers::gershgorin_eigenvalue_estimate(), get_matrix_transpose(), global_matrix(), inf_norm(), oomph::CRDoubleMatrixHelpers::inf_norm(), oomph::BlockPreconditioner< MATRIX >::internal_get_block(), matrix_reduction(), oomph::MGSolver< DIM >::modify_restriction_matrices(), multiply(), multiply_transpose(), redistribute(), oomph::MatrixBasedLumpedPreconditioner< MATRIX >::setup(), oomph::ILUZeroPreconditioner< CRDoubleMatrix >::setup(), oomph::PseudoElasticPreconditionerSubsidiaryPreconditionerOld::setup(), oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures(), oomph::GS< CRDoubleMatrix >::solve_helper(), sort_entries(), and sparse_indexed_output_with_offset().
|
inline |
Access to C-style value array (const version)
References CR_matrix, and oomph::SparseMatrix< T, MATRIX_TYPE >::value().
|
private |
Flag to indicate whether the matrix has been built - i.e. the distribution has been setup AND the matrix has been assembled.
Referenced by build(), build_without_copy(), built(), clear(), CRDoubleMatrix(), ludecompose(), multiply(), and multiply_transpose().
struct oomph::CRDoubleMatrix::CRDoubleMatrixComparisonHelper oomph::CRDoubleMatrix::Comparison_struct |
Referenced by sort_entries().
Storage for the Matrix in CR Format.
Referenced by build(), build_without_copy(), clear(), column_index(), CRDoubleMatrix(), diagonal_entries(), inf_norm(), matrix_reduction(), multiply(), multiply_transpose(), ncol(), nnz(), operator()(), output_bottom_right_zero_helper(), row_start(), sparse_indexed_output_helper(), and value().
|
private |
Flag to determine which matrix-matrix multiplication method is used (for distributed matrices)
Referenced by distributed_matrix_matrix_multiply_method().
Vector whose i'th entry contains the index of the last entry below or on the diagonal of the i'th row of the matrix
Referenced by get_index_of_diagonal_entries(), and sort_entries().
|
private |
Flag to determine which matrix-matrix multiplication method is used (for serial (or global) matrices)
Referenced by CRDoubleMatrix(), multiply(), and serial_matrix_matrix_multiply_method().