Go to the documentation of this file.
7 #ifndef __IPCOMPOUNDMATRIX_HPP__
8 #define __IPCOMPOUNDMATRIX_HPP__
17 class CompoundMatrixSpace;
88 return ConstComp(irow, jcol);
104 return Comp(irow, jcol);
108 inline Index NComps_Rows()
const;
111 inline Index NComps_Cols()
const;
162 const std::string& name,
164 const std::string& prefix
190 std::vector<std::vector<SmartPtr<Matrix> > >
comps_;
206 inline const Matrix* ConstComp(
278 bool auto_allocate =
false
292 return comp_spaces_[irow][jcol];
321 return MakeNewCompoundMatrix();
bool dimensions_set_
Store whether or not the dimensions are valid.
MatrixSpace base class, corresponding to the Matrix base class.
Index NComps_Rows() const
Number of block rows of this compound matrix.
const CompoundMatrixSpace * owner_space_
Copy of the owner_space ptr as a CompoundMatrixSpace instead of MatrixSpace.
std::vector< std::vector< bool > > allocate_block_
2-dim std::vector of booleans deciding whether to allocate a new matrix for the blocks automagically
bool matrices_valid_
boolean indicating if the compound matrix is in a "valid" state
CompoundMatrix(const CompoundMatrix &)
Copy Constructor.
void SetBlockRows(Index irow, Index nrows)
Set the number nrows of rows in row-block number irow.
CompoundMatrix()
Default Constructor.
Index NComps_Cols() const
Number of block colmuns of this compound matrix.
void SetComp(Index irow, Index jcol, const Matrix &matrix)
Method for setting an individual component at position (irow, icol) in the compound matrix.
bool Diagonal() const
True if the blocks lie on the diagonal - can make some operations faster.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
void SetCompSpace(Index irow, Index jcol, const MatrixSpace &mat_space, bool auto_allocate=false)
Set the component MatrixSpace.
double Number
Type of all numbers.
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
void operator=(const CompoundMatrix &)
Default Assignment Operator.
Class for Matrices consisting of other matrices.
SmartPtr< Matrix > GetCompNonConst(Index irow, Index jcol)
Method for retrieving one block from the compound matrix as a non-const Matrix.
std::vector< std::vector< SmartPtr< Matrix > > > comps_
Matrix of matrix's containing the components.
virtual void SinvBlrmZMTdBrImpl(Number alpha, const Vector &S, const Vector &R, const Vector &Z, const Vector &D, Vector &X) const
X = S^{-1} (r + alpha*Z*M^Td).
bool MatricesValid() const
Method to check whether or not the matrices are valid.
EJournalLevel
Print Level Enum.
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Compute the max-norm of the columns in the matrix.
bool diagonal_
true if the CompoundMatrixSpace only has Matrix spaces along the diagonal.
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
virtual ~CompoundMatrix()
Destructor.
SmartPtr< const Matrix > GetComp(Index irow, Index jcol) const
Method for retrieving one block from the compound matrix as a const Matrix.
int Index
Type of all indices of vectors, matrices etc.
Index ncomps_cols_
Number of block columns.
CompoundMatrixSpace(Index ncomps_rows, Index ncomps_cols, Index total_nRows, Index total_nCols)
Constructor, given the number of row and columns blocks, as well as the totel number of rows and colu...
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
Print detailed information about the matrix.
U * GetRawPtr(const SmartPtr< U > &smart_ptr)
const Matrix * ConstComp(Index irow, Index jcol) const
virtual void AddMSinvZImpl(Number alpha, const Vector &S, const Vector &Z, Vector &X) const
X = X + alpha*(Matrix S^{-1} Z).
Template class for Smart Pointers.
This is the matrix space for CompoundMatrix.
CompoundMatrixSpace & operator=(const CompoundMatrixSpace &)
Default Assignment Operator.
EJournalCategory
Category Selection Enum.
std::vector< std::vector< SmartPtr< const MatrixSpace > > > comp_spaces_
2-dim std::vector of matrix spaces for the components
std::vector< Index > block_rows_
Vector of the number of rows in each comp column.
Matrix * Comp(Index irow, Index jcol)
Index NComps_Cols() const
Number of block columns.
bool DimensionsSet() const
Auxiliary function for debugging to set if all block dimensions have been set.
SmartPtr< const MatrixSpace > GetCompSpace(Index irow, Index jcol) const
Obtain the component MatrixSpace in block row irow and block column jcol.
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
void CreateBlockFromSpace(Index irow, Index jcol)
Method to create a new matrix from the space for this block.
CompoundMatrixSpace(const CompoundMatrixSpace &)
Copy Constructor.
Class responsible for all message output.
std::vector< Index > block_cols_
Vector of the number of cols in each comp row.
Index GetBlockRows(Index irow) const
Get the number nrows of rows in row-block number irow.
Index NComps_Rows() const
Number of block rows.
bool IsValid(const SmartPtr< U > &smart_ptr)
std::vector< std::vector< SmartPtr< const Matrix > > > const_comps_
Matrix of const matrix's containing the components.
CompoundMatrixSpace()
Default constructor.
Index GetBlockCols(Index jcol) const
Set the number ncols of columns in column-block number jcol.
virtual Matrix * MakeNew() const
Pure virtual method for creating a new Matrix of the corresponding type.
~CompoundMatrixSpace()
Destructor.
CompoundMatrix(const CompoundMatrixSpace *owner_space)
Constructor, taking the owner_space.
CompoundMatrix * MakeNewCompoundMatrix() const
Method for creating a new matrix of this specific type.
void SetBlockCols(Index jcol, Index ncols)
Set the number ncols of columns in column-block number jcol.
void SetCompNonConst(Index irow, Index jcol, Matrix &matrix)
Method to set a non-const Matrix entry.
Index ncomps_rows_
Number of block rows.