LAMA
|
#include <MetaMatrix.hpp>
Public Types | |
typedef std::string::const_iterator | StringIterator |
enum | SyncKind { ASYNCHRONOUS, SYNCHRONOUS } |
SyncKind describes if the communication and computation should be done synchronously or asynchronously. More... | |
enum | MatrixKind { DENSE, SPARSE } |
MatrixKind describes if a matrix is dense or sparse. More... | |
typedef const Matrix & | ExpressionMemberType |
ExpressionMemberType is the type that is used the template Expression to store a Vector. | |
Public Member Functions | |
MetaMatrix (Matrix &other, const std::string &config) | |
Construct a square matrix with the given size and the specified distribution. | |
virtual | ~MetaMatrix () |
virtual destructor of MetaMatrix | |
void | interpreteArgument (Matrix &other, const std::string &arg) |
void | parseConfiguration (Matrix &other, const std::string &configuration) |
virtual const char * | getTypeName () const |
Virtual method that delivers the class name to which a matrix belongs. | |
virtual void | clear () |
Clear the full matrix, resets global and local sizes to 0. | |
virtual void | allocate (const IndexType numRows, const IndexType numColumns) |
Reallocate this matrix to a replicated zero-matrix of the given shape. | |
virtual void | allocate (DistributionPtr rowDistribution, DistributionPtr colDistribution) |
Reallocate this matrix to a distributed zero-matrix by the given distributions. | |
virtual void | setIdentity () |
Operator that sets the matrix to the identity matrix. | |
virtual void | assign (const Matrix &other) |
This method assigns a matrix to this matrix with automatic conversion to the matrix type and the current row / column distribution of *this. | |
virtual void | assign (const _MatrixStorage &other) |
This method assigns replicated/global matrix storage data to this matrix. | |
virtual void | assign (const _MatrixStorage &storage, DistributionPtr rowDist, DistributionPtr colDist) |
Assign local storage for a distributed matrix. | |
virtual void | buildLocalStorage (_MatrixStorage &storage) const |
Get the local part (no splitted columns) of a matrix as if colDist is replicated. | |
virtual void | redistribute (DistributionPtr rowDistribution, DistributionPtr colDistribution) |
This method allows any arbitrary redistribution of the matrix. | |
virtual void | getRow (Vector &row, const IndexType globalRowIndex) const |
This method returns one row of the matrix. | |
virtual void | getDiagonal (Vector &diagonal) const |
This method returns the diagonal. | |
virtual void | setDiagonal (const Vector &diagonal) |
This method replaces the diagonal. | |
virtual void | setDiagonal (const Scalar scalar) |
This method replaces the diagonal by a diagonal value. | |
virtual void | scale (const Vector &scaling) |
This method scales all values with a vector. | |
virtual void | scale (const Scalar scaling) |
This method scales all matrix values with a scalar. | |
virtual Scalar | getValue (IndexType i, IndexType j) const |
returns a copy of the value at the passed global indexes. | |
virtual IndexType | getNumValues () const |
Get the total number of non-zero values in the matrix. | |
virtual void | matrixTimesVector (Vector &result, const Scalar alpha, const Vector &x, const Scalar beta, const Vector &y) const |
matrixTimesVector computes result = alpha * this * x + beta * y | |
virtual void | matrixTimesScalar (const Matrix &other, const Scalar alpha) |
matrixTimesScalar computes this = alpha * other | |
virtual void | matrixTimesMatrix (Matrix &result, const Scalar alpha, const Matrix &B, const Scalar beta, const Matrix &C) const |
matrixTimesMatrix computes result = alpha * this * B + beta * C | |
virtual IndexType | getLocalNumValues () const |
Getter routine for the local number of stored values. | |
virtual IndexType | getLocalNumRows () const |
Getter routine for the local number of rows. | |
virtual IndexType | getLocalNumColumns () const |
Getter routine for the local number of rows and columns. | |
virtual void | setContext (const ContextPtr context) |
specifies on which compute back end the matrix operations should take place. | |
virtual ContextPtr | getContextPtr () const |
Getter routine for the context. | |
virtual MatrixKind | getMatrixKind () const |
Each derived matrix must give info about its kind (DENSE or SPARSE). | |
virtual void | prefetch () const |
Prefetch matrix data to its 'preferred' context location. | |
virtual void | wait () const |
wait for a possibly running prefetch. | |
virtual void | invert (const Matrix &other) |
Compute the inverse of a matrix. | |
virtual Scalar | maxDiffNorm (const Matrix &other) const |
returns the max norm of ( this - other ) | |
virtual std::auto_ptr< Matrix > | create () const |
Constructor function which creates a 'zero' matrix of same type as a given matrix. | |
virtual std::auto_ptr< Matrix > | copy () const |
Constructor function which creates a copy of this matrix. | |
virtual Scalar::ScalarType | getValueType () const |
Query the value type of the matrix elements, e.g. | |
virtual bool | hasDiagonalProperty () const |
hasDiagonalProperty returns the diagonalProperty of the local storage. | |
virtual void | resetDiagonalProperty () |
resetDiagonalProperty rechecks the storages for their diagonal property | |
virtual size_t | getMemoryUsage () const |
getMemoryUsage returns the global memory that is allocated to hold this matrix. | |
std::auto_ptr< _LAMAArray > | createArray () const |
This routine creates a LAMA array with the same value type as the matrix. | |
Scalar | operator() (IndexType i, IndexType j) const |
returns a copy of the value at the passed global indexes. | |
virtual void | writeAt (std::ostream &stream) const |
Write some information about this to the passed stream. | |
IndexType | getNumRows () const |
Returns the number of global rows. | |
IndexType | getNumColumns () const |
Returns the number of columns. | |
double | getSparsityRate () const |
virtual void | matrix2CSRGraph (IndexType *xadj, IndexType *adjncy, IndexType *vwgt, CommunicatorPtr comm, const IndexType *globalRowIndices=NULL, IndexType *vtxdist=NULL) const |
transformation from matrix type to a csr graph | |
const Distribution & | getColDistribution () const |
gets a constant reference to the column distribution. | |
DistributionPtr | getColDistributionPtr () const |
gets a pointer to the column distribution. | |
virtual void | setContext (const ContextPtr localContext, const ContextPtr haloContext) |
Only sparse matrices will override this method, others will ignore second argument. | |
const Context & | getContext () const |
SyncKind | getCommunicationKind () const |
get the communication kind. | |
SyncKind | getComputeKind () const |
get the compute kind. | |
void | setCommunicationKind (SyncKind communicationKind) |
set the communication kind. | |
virtual void | setComputeKind (SyncKind computeKind) |
set the compute kind. | |
void | inheritAttributes (const Matrix &other) |
Inherit context and kind arguments from another matrix. | |
std::auto_ptr< Matrix > | create (const IndexType numRows, const IndexType numColumns) const |
Constructor creates a replicated matrix of same type as a given matrix. | |
std::auto_ptr< Matrix > | create (const IndexType size) const |
Constructor creates a distributed zero matrix of same type as a given matrix. | |
std::auto_ptr< Matrix > | create (DistributionPtr rowDistribution, DistributionPtr colDistribution) const |
Constructor creates a distributed zero matrix of same type as a given matrix. | |
std::auto_ptr< Matrix > | create (DistributionPtr distribution) const |
Constructor creates a distributed zero matrix of same type as a given matrix. | |
VectorPtr | createDenseVector (DistributionPtr distribution, const Scalar value) const |
Constructor creates a distributed dense vector of same type as a given matrix. | |
const Distribution & | getDistribution () const |
DistributionPtr | getDistributionPtr () const |
Protected Member Functions | |
void | setReplicatedMatrix (const IndexType numRows, const IndexType numColumns) |
Set the global/local size of replicated matrix. | |
void | setDistributedMatrix (DistributionPtr distribution, DistributionPtr colDistribution) |
Set the global and local size of distributed matrix. | |
void | checkSettings () |
void | swapMatrix (Matrix &other) |
void | swap (Distributed &other) |
void | setDistributionPtr (DistributionPtr distributionPtr) |
Protected Attributes | |
DistributionPtr | mColDistribution |
IndexType | mNumRows |
IndexType | mNumColumns |
Private Member Functions | |
LAMA_LOG_DECL_STATIC_LOGGER (logger) | |
Private Attributes | |
MatrixPtr | mMatrix |
typedef const Matrix& lama::Matrix::ExpressionMemberType [inherited] |
ExpressionMemberType is the type that is used the template Expression to store a Vector.
typedef std::string::const_iterator lama::MetaMatrix::StringIterator |
enum lama::Matrix::MatrixKind [inherited] |
enum lama::Matrix::SyncKind [inherited] |
lama::MetaMatrix::MetaMatrix | ( | Matrix & | other, |
const std::string & | config | ||
) |
Construct a square matrix with the given size and the specified distribution.
[in] | matrixInput | Specifies the file name of the Matrix which used to create the generated matrix. |
[in] | config | Configuration which will be parsed to generate the defined matrix |
References interpreteArgument().
lama::MetaMatrix::~MetaMatrix | ( | ) | [virtual] |
virtual destructor of MetaMatrix
void lama::MetaMatrix::allocate | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) | [virtual] |
Reallocate this matrix to a replicated zero-matrix of the given shape.
[in] | numRows | number of rows |
[in] | numColumns | number of columns |
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::allocate | ( | DistributionPtr | rowDistribution, |
DistributionPtr | colDistribution | ||
) | [virtual] |
Reallocate this matrix to a distributed zero-matrix by the given distributions.
[in] | distribution | is row distribution, number of rows given by getGlobalSize() |
[in] | colDistribution | is col distribution, number of columns given by getGlobalSize() |
The distributions specify the new global and the new local sizes for a distributed matrix.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::assign | ( | const Matrix & | other | ) | [virtual] |
This method assigns a matrix to this matrix with automatic conversion to the matrix type and the current row / column distribution of *this.
Note: other.getNumRows() == getNumRows(), other.getNumColumns() == getNumColumns() is mandatory
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::assign | ( | const _MatrixStorage & | other | ) | [virtual] |
This method assigns replicated/global matrix storage data to this matrix.
Note: the current matrix data will be overridden.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::assign | ( | const _MatrixStorage & | storage, |
DistributionPtr | rowDist, | ||
DistributionPtr | colDist | ||
) | [virtual] |
Assign local storage for a distributed matrix.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::buildLocalStorage | ( | _MatrixStorage & | storage | ) | const [virtual] |
Get the local part (no splitted columns) of a matrix as if colDist is replicated.
[out] | storage | will contain the local part of the matrix with all columns. |
As splitting of columns is differently handled for sparse and dense matrices, this method is useful for conversion between them. An alternative solution of copying the whole matrix and replication of columns might be too expensive.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::Matrix::checkSettings | ( | ) | [protected, inherited] |
Reimplemented in lama::SparseMatrix< T >, and lama::SparseMatrix< ValueType >.
References lama::Matrix::getColDistribution(), lama::Distributed::getDistribution(), LAMA_THROWEXCEPTION, lama::Matrix::mColDistribution, lama::Matrix::mNumColumns, and lama::Matrix::mNumRows.
Referenced by lama::Matrix::Matrix().
void lama::MetaMatrix::clear | ( | ) | [virtual] |
Clear the full matrix, resets global and local sizes to 0.
CSRSparseMatrix<double> a ( ... ); a = CSRSparseMatrix<double> (); \\ will free all arrays a.clear(); \\ same functionality, clears involved arrays
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
std::auto_ptr< Matrix > lama::MetaMatrix::copy | ( | ) | const [virtual] |
Constructor function which creates a copy of this matrix.
std::auto_ptr<Matrix> newMatrix = matrix.copy();
// More convenient to use, but exactly same as follows:
std::auto_ptr<Matrix> newMatrix = matrix.create(); *newMatrix = matrix;
This method is a workaround to call the copy constructor of a derived matrix class where the derived class is not known at compile time.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
Referenced by interpreteArgument().
std::auto_ptr< Matrix > lama::MetaMatrix::create | ( | ) | const [virtual] |
Constructor function which creates a 'zero' matrix of same type as a given matrix.
void sub( ..., const Matrix& matrix, ...) { ... // Create a copy of the input matrix std::auto_ptr<Matrix> newMatrix = matrix.create(); *newMatrix = matrix; // Create a unity matrix of same type and same row distribution as matrix std::auto_ptr<Matrix> newMatrix = matrix.create(); newMatrix->allocate( matrix.getRowDistributionPtr(), matrix.getRowDistributionPtr() ); newMatrix->setIdentity(); ... }
This method is a workaround to call the constructor of a derived matrix class where the derived class is not known at compile time.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
std::auto_ptr< Matrix > lama::Matrix::create | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) | const [inherited] |
Constructor creates a replicated matrix of same type as a given matrix.
References lama::Matrix::create().
std::auto_ptr< Matrix > lama::Matrix::create | ( | const IndexType | size | ) | const [inherited] |
Constructor creates a distributed zero matrix of same type as a given matrix.
References lama::Matrix::create().
std::auto_ptr< Matrix > lama::Matrix::create | ( | DistributionPtr | rowDistribution, |
DistributionPtr | colDistribution | ||
) | const [inherited] |
Constructor creates a distributed zero matrix of same type as a given matrix.
References lama::Matrix::create().
std::auto_ptr< Matrix > lama::Matrix::create | ( | DistributionPtr | distribution | ) | const [inherited] |
Constructor creates a distributed zero matrix of same type as a given matrix.
References lama::Matrix::create().
std::auto_ptr< _LAMAArray > lama::Matrix::createArray | ( | ) | const [inherited] |
This routine creates a LAMA array with the same value type as the matrix.
: returns an auto pointer to the LAMA array.
Same as _LAMAArray::create( this.getValueType() )
Value type is known only at runtime, so pointer to the base class is returned. Auto pointer indicates that calling routine takes ownership of the allocated array.
References lama::Matrix::create(), and lama::Matrix::getValueType().
VectorPtr lama::Matrix::createDenseVector | ( | DistributionPtr | distribution, |
const Scalar | value | ||
) | const [inherited] |
Constructor creates a distributed dense vector of same type as a given matrix.
References lama::Scalar::DOUBLE, lama::Scalar::FLOAT, lama::Scalar::getValue(), lama::Matrix::getValueType(), and LAMA_THROWEXCEPTION.
const Distribution & lama::Matrix::getColDistribution | ( | ) | const [inline, inherited] |
gets a constant reference to the column distribution.
References LAMA_ASSERT_ERROR, and lama::Matrix::mColDistribution.
Referenced by lama::DenseMatrix< T >::assignSparse(), lama::Matrix::checkSettings(), lama::LUSolver::computeLUFactorization(), lama::InverseSolver::decompose(), lama::DenseMatrix< T >::DenseMatrix(), lama::DenseMatrixOps::invert(), lama::InverseSolver::invert(), lama::DenseMatrixOps::invertReplicated(), lama::SpecializedJacobi::iterateTyped(), lama::Matrix::Matrix(), lama::DenseMatrix< T >::matrixTimesMatrix(), lama::SparseMatrix< T >::matrixTimesMatrixImpl(), lama::CRTPMatrix< DenseMatrix< T >, T >::matrixTimesVector(), lama::SparseMatrix< T >::matrixTimesVectorNImpl(), lama::DenseMatrix< T >::maxDiffNorm(), lama::SparseMatrix< T >::maxDiffNorm(), lama::DenseMatrix< T >::maxDiffNormImpl(), lama::SparseMatrix< T >::maxDiffNormImpl(), lama::Matrix::operator=(), lama::LUSolver::solve(), and lama::Solver::solveInit().
DistributionPtr lama::Matrix::getColDistributionPtr | ( | ) | const [inline, inherited] |
gets a pointer to the column distribution.
References LAMA_ASSERT_ERROR, and lama::Matrix::mColDistribution.
Referenced by lama::SparseMatrix< T >::assign(), lama::DenseMatrix< T >::assign(), lama::DenseMatrix< T >::assignSparse(), lama::SparseMatrix< T >::assignTransposeImpl(), lama::DenseMatrix< T >::copyDenseMatrix(), lama::MatrixCreator< T >::fillRandom(), lama::DenseMatrixOps::invert(), lama::DenseMatrix< T >::invert(), lama::DenseMatrix< T >::matrixTimesMatrix(), lama::SparseMatrix< T >::matrixTimesMatrixImpl(), and lama::SparseMatrix< T >::matrixTimesVectorNImpl().
Matrix::SyncKind lama::Matrix::getCommunicationKind | ( | ) | const [inline, inherited] |
get the communication kind.
References lama::Matrix::mCommunicationKind.
Referenced by lama::Matrix::inheritAttributes(), lama::SpecializedJacobi::iterateTyped(), and lama::DenseMatrix< T >::matrixTimesVectorImpl().
Matrix::SyncKind lama::Matrix::getComputeKind | ( | ) | const [inline, inherited] |
get the compute kind.
References lama::Matrix::mComputeKind.
Referenced by lama::Matrix::inheritAttributes().
const Context& lama::Matrix::getContext | ( | ) | const [inline, inherited] |
Reimplemented in lama::SparseMatrix< T >, and lama::SparseMatrix< ValueType >.
ContextPtr lama::MetaMatrix::getContextPtr | ( | ) | const [virtual] |
Getter routine for the context.
Note: Only for SparseMatrix the context of the halo can be queried.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::getDiagonal | ( | Vector & | diagonal | ) | const [virtual] |
This method returns the diagonal.
[out] | diagonal | is the destination array |
Calculations are dependent to the diagonal property.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
const Distribution & lama::Distributed::getDistribution | ( | ) | const [inline, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::SparseMatrix< T >::assignTransposeImpl(), lama::Matrix::checkSettings(), lama::LUSolver::computeLUFactorization(), lama::InverseSolver::decompose(), lama::DenseMatrix< T >::DenseMatrix(), lama::DenseVector< T >::DenseVector(), lama::DenseVector< T >::dotProduct(), lama::MatrixCreator< T >::fillRandom(), lama::SparseMatrix< T >::getLocalRow(), lama::SparseMatrix< T >::getRow(), lama::DenseMatrix< T >::getRow(), lama::DenseMatrixOps::invert(), lama::InverseSolver::invert(), lama::DenseMatrixOps::invertCyclic(), lama::DenseMatrixOps::invertReplicated(), lama::Matrix::Matrix(), lama::DenseMatrix< T >::matrixTimesMatrix(), lama::SparseMatrix< T >::matrixTimesMatrixImpl(), lama::CRTPMatrix< DenseMatrix< T >, T >::matrixTimesVector(), lama::SparseMatrix< T >::matrixTimesVector(), lama::SparseMatrix< T >::matrixTimesVectorNImpl(), lama::DenseMatrix< T >::maxDiffNorm(), lama::SparseMatrix< T >::maxDiffNorm(), lama::DenseMatrix< T >::maxDiffNormImpl(), lama::SparseMatrix< T >::maxDiffNormImpl(), lama::Matrix::operator=(), lama::SparseMatrix< T >::scale(), lama::SparseMatrix< T >::setDiagonal(), lama::LUSolver::solve(), lama::Solver::solveInit(), lama::Vector::Vector(), and lama::Vector::~Vector().
DistributionPtr lama::Distributed::getDistributionPtr | ( | ) | const [inline, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::SparseMatrix< T >::assign(), lama::DenseMatrix< T >::assign(), lama::DenseVector< T >::assign(), lama::DenseMatrix< T >::assignSparse(), lama::SparseMatrix< T >::assignTransposeImpl(), lama::DenseMatrix< T >::copyDenseMatrix(), lama::DenseVector< T >::DenseVector(), lama::MatrixCreator< T >::fillRandom(), lama::SingleGridSetup::initialize(), lama::CG::initialize(), lama::DefaultJacobi::initialize(), lama::GMRES::initialize(), lama::DenseMatrixOps::invert(), lama::DenseMatrix< T >::invert(), lama::DenseMatrixOps::invertCyclic(), lama::GMRES::iterate(), lama::SparseMatrix< T >::matrixTimesMatrixImpl(), lama::CRTPMatrix< DenseMatrix< T >, T >::matrixTimesVector(), lama::Vector::operator=(), lama::Vector::size(), and lama::Vector::writeAt().
IndexType lama::MetaMatrix::getLocalNumColumns | ( | ) | const [virtual] |
Getter routine for the local number of rows and columns.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
IndexType lama::MetaMatrix::getLocalNumRows | ( | ) | const [virtual] |
Getter routine for the local number of rows.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
IndexType lama::MetaMatrix::getLocalNumValues | ( | ) | const [virtual] |
Getter routine for the local number of stored values.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
Matrix::MatrixKind lama::MetaMatrix::getMatrixKind | ( | ) | const [virtual] |
Each derived matrix must give info about its kind (DENSE or SPARSE).
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
size_t lama::MetaMatrix::getMemoryUsage | ( | ) | const [virtual] |
getMemoryUsage returns the global memory that is allocated to hold this matrix.
getMemoryUsage returns the global memory that is allocated to hold this matrix. For a distributed matrix all partitions are summed together.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
IndexType lama::Matrix::getNumColumns | ( | ) | const [inline, inherited] |
Returns the number of columns.
References lama::Matrix::mNumColumns.
Referenced by lama::DenseMatrix< T >::assignSparse(), lama::LUSolver::computeLUFactorization(), lama::InverseSolver::decompose(), lama::DenseMatrix< T >::DenseMatrix(), lama::MatrixCreator< T >::fillRandom(), lama::SparseMatrix< T >::getLocalNumColumns(), lama::InverseSolver::invert(), lama::DenseMatrix< T >::invert(), lama::DenseMatrixOps::invertCyclic(), lama::MatrixConfigGrammar::MatrixConfigGrammar(), lama::Matrix::operator=(), lama::LUSolver::solve(), and lama::Solver::solveInit().
IndexType lama::Matrix::getNumRows | ( | ) | const [inline, inherited] |
Returns the number of global rows.
References lama::Matrix::mNumRows.
Referenced by lama::InverseSolver::computeInverse(), lama::LUSolver::computeLUFactorization(), lama::InverseSolver::decompose(), lama::SparseMatrix< T >::getLocalNumRows(), lama::LUSolver::initialize(), lama::DenseMatrixOps::invert(), lama::InverseSolver::invert(), lama::DenseMatrix< T >::invert(), lama::DenseMatrixOps::invertCyclic(), lama::SpecializedJacobi::iterateTyped(), lama::MatrixConfigGrammar::MatrixConfigGrammar(), lama::Matrix::operator=(), lama::LUSolver::solve(), and lama::Solver::solveInit().
IndexType lama::MetaMatrix::getNumValues | ( | ) | const [virtual] |
Get the total number of non-zero values in the matrix.
An element is considered to be non-zero if its absolute value is greater equal than mEpsilon. Zero diagonal elements are also counted if this->hasDiagonalProperty() is given.
This routine does not count zero elements even if they are stored (e.g. for dense or dia storage data).
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::getRow | ( | Vector & | row, |
const IndexType | globalRowIndex | ||
) | const [virtual] |
This method returns one row of the matrix.
[out] | row | is a replicated vector with all values of the row |
Note: the value type of the vector should be the same type as the matrix (otherwise conversion) and it should be a replicated vector (otherwise reallocation)
Unclear: should the distribution always be unchanged ?
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
double lama::Matrix::getSparsityRate | ( | ) | const [inherited] |
References lama::Matrix::getNumValues(), lama::Matrix::mNumColumns, and lama::Matrix::mNumRows.
const char * lama::MetaMatrix::getTypeName | ( | ) | const [virtual] |
Virtual method that delivers the class name to which a matrix belongs.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
Scalar lama::MetaMatrix::getValue | ( | IndexType | i, |
IndexType | j | ||
) | const [virtual] |
returns a copy of the value at the passed global indexes.
[in] | i | the global row index |
[in] | j | the global column index |
As this operation requires communication ins SPMD mode it can be very inefficient in some situations.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
Scalar::ScalarType lama::MetaMatrix::getValueType | ( | ) | const [virtual] |
Query the value type of the matrix elements, e.g.
DOUBLE or FLOAT.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
bool lama::MetaMatrix::hasDiagonalProperty | ( | ) | const [virtual] |
hasDiagonalProperty returns the diagonalProperty of the local storage.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::Matrix::inheritAttributes | ( | const Matrix & | other | ) | [inherited] |
Inherit context and kind arguments from another matrix.
This routine will also be used by copy constructors in base classes.
References lama::Matrix::getCommunicationKind(), lama::Matrix::getComputeKind(), lama::Matrix::getContextPtr(), lama::Matrix::setCommunicationKind(), lama::Matrix::setComputeKind(), and lama::Matrix::setContext().
void lama::MetaMatrix::interpreteArgument | ( | Matrix & | other, |
const std::string & | arg | ||
) |
References copy(), and parseConfiguration().
Referenced by MetaMatrix().
void lama::MetaMatrix::invert | ( | const Matrix & | other | ) | [virtual] |
lama::MetaMatrix::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [private] |
Reimplemented from lama::Matrix.
void lama::Matrix::matrix2CSRGraph | ( | IndexType * | xadj, |
IndexType * | adjncy, | ||
IndexType * | vwgt, | ||
CommunicatorPtr | comm, | ||
const IndexType * | globalRowIndices = NULL , |
||
IndexType * | vtxdist = NULL |
||
) | const [virtual, inherited] |
transformation from matrix type to a csr graph
transformation from matrix type to a csr graph, so that it (Par)Metis can work with it.
[out] | xadj | the ia array of the csr graph |
[out] | adjncy | the ja array of the csr graph |
References LAMA_THROWEXCEPTION.
void lama::MetaMatrix::matrixTimesMatrix | ( | Matrix & | result, |
const Scalar | alpha, | ||
const Matrix & | B, | ||
const Scalar | beta, | ||
const Matrix & | C | ||
) | const [virtual] |
matrixTimesMatrix computes result = alpha * this * B + beta * C
[out] | result | the Matrix to store the result to |
[in] | alpha | the Scalar alpha of the expression |
[in] | B | the Matrix B of the expression |
[in] | beta | the Scalar beta of the expression |
[in] | C | the Matrix C of the expression |
matrixTimesMatrix computes result = alpha * this * x + beta * y.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::matrixTimesScalar | ( | const Matrix & | other, |
const Scalar | alpha | ||
) | [virtual] |
matrixTimesScalar computes this = alpha * other
matrixTimesScalar computes this = alpha * other.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::matrixTimesVector | ( | Vector & | result, |
const Scalar | alpha, | ||
const Vector & | x, | ||
const Scalar | beta, | ||
const Vector & | y | ||
) | const [virtual] |
matrixTimesVector computes result = alpha * this * x + beta * y
[out] | result | the Vector to store the result to |
[in] | alpha | the Scalar alpha of the expression |
[in] | x | the Vector x of the expression |
[in] | beta | the Scalar beta of the expression |
[in] | y | the Vector y of the expression |
matrixTimesVector computes result = alpha * this * x + beta * y. If result == x or result == y new storage is allocated to store the result.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
Scalar lama::MetaMatrix::maxDiffNorm | ( | const Matrix & | other | ) | const [virtual] |
returns the max norm of ( this - other )
[in] | other | another matrix with the same shape as this matrix |
The maximal value is given by the largest difference between two elements at the same position of the matrices.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
returns a copy of the value at the passed global indexes.
[in] | i | the global row index |
[in] | j | the global column index |
As this operator requires communication ins SPMD mode it can be very inefficient in some situations.
References lama::Matrix::getValue().
void lama::MetaMatrix::parseConfiguration | ( | Matrix & | other, |
const std::string & | configuration | ||
) |
References LAMA_ASSERT, LAMA_THROWEXCEPTION, and mMatrix.
Referenced by interpreteArgument().
void lama::MetaMatrix::prefetch | ( | ) | const [virtual] |
Prefetch matrix data to its 'preferred' context location.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::redistribute | ( | DistributionPtr | rowDistribution, |
DistributionPtr | colDistribution | ||
) | [virtual] |
This method allows any arbitrary redistribution of the matrix.
[in] | rowDistribution | is new distribution of rows, global size must be mNumRows |
[in] | colDistribution | is new distribution of columns, global size must be mNumColumns |
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::resetDiagonalProperty | ( | ) | [virtual] |
resetDiagonalProperty rechecks the storages for their diagonal property
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::scale | ( | const Vector & | scaling | ) | [virtual] |
This method scales all values with a vector.
[in] | values | is the source array |
row wise calculations
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::scale | ( | const Scalar | scaling | ) | [virtual] |
This method scales all matrix values with a scalar.
[in] | value | is the source value |
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::Matrix::setCommunicationKind | ( | SyncKind | communicationKind | ) | [inherited] |
set the communication kind.
[in] | communicationKind | the communication kind. |
References lama::Matrix::mCommunicationKind.
Referenced by lama::Matrix::inheritAttributes().
void lama::Matrix::setComputeKind | ( | SyncKind | computeKind | ) | [virtual, inherited] |
set the compute kind.
[in] | computeKind | the compute kind. |
Reimplemented in lama::SparseMatrix< T >, and lama::SparseMatrix< ValueType >.
References lama::Matrix::mComputeKind.
Referenced by lama::Matrix::inheritAttributes().
void lama::MetaMatrix::setContext | ( | const ContextPtr | context | ) | [virtual] |
specifies on which compute back end the matrix operations should take place.
[in] | context | the compute back to use for calculations with matrix |
Note: Only for sparse matrices it is possible to specify separate locations for local and halo computations.
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::Matrix::setContext | ( | const ContextPtr | localContext, |
const ContextPtr | haloContext | ||
) | [virtual, inherited] |
Only sparse matrices will override this method, others will ignore second argument.
Reimplemented in lama::SparseMatrix< T >, and lama::SparseMatrix< ValueType >.
References lama::Matrix::setContext().
void lama::MetaMatrix::setDiagonal | ( | const Vector & | diagonal | ) | [virtual] |
This method replaces the diagonal.
[in] | diagonal | is the source array |
Calculations are dependent to the diagonal property
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::MetaMatrix::setDiagonal | ( | const Scalar | scalar | ) | [virtual] |
This method replaces the diagonal by a diagonal value.
[in] | scalar | is the source value |
Calculations are dependent to the diagonal property
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::Matrix::setDistributedMatrix | ( | DistributionPtr | distribution, |
DistributionPtr | colDistribution | ||
) | [protected, inherited] |
Set the global and local size of distributed matrix.
[in] | distribution | is distribution for rows |
[in] | colDistribution | is distribution for columns |
Global and local size is given implicitly by the distributions itself.
References LAMA_ASSERT_ERROR, lama::Matrix::mColDistribution, lama::Matrix::mNumColumns, lama::Matrix::mNumRows, and lama::Distributed::setDistributionPtr().
Referenced by lama::DenseMatrix< T >::allocate(), lama::SimpleStorageStrategy< ValueType >::applyStrategy(), lama::DenseMatrix< T >::assign(), lama::DenseMatrix< T >::assignSparse(), lama::COOSparseMatrix< T >::COOSparseMatrix(), lama::DenseMatrix< T >::copyDenseMatrix(), lama::CSRSparseMatrix< T >::CSRSparseMatrix(), lama::DIASparseMatrix< T >::DIASparseMatrix(), lama::ELLSparseMatrix< T >::ELLSparseMatrix(), lama::JDSSparseMatrix< T >::JDSSparseMatrix(), lama::Matrix::Matrix(), lama::Matrix::setReplicatedMatrix(), lama::DenseMatrix< T >::splitColumns(), and lama::XXXSparseMatrix< T >::XXXSparseMatrix().
void lama::Distributed::setDistributionPtr | ( | DistributionPtr | distributionPtr | ) | [protected, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::Vector::resize(), and lama::Matrix::setDistributedMatrix().
void lama::MetaMatrix::setIdentity | ( | ) | [virtual] |
Operator that sets the matrix to the identity matrix.
void sub( ..., Matrix& a, ... ) ... LAMA_ASSERT_EQUAL_DEBUG( a.getNumRows(), a.getNumColumns() ); A.setIdentity();
Implements lama::Matrix.
References LAMA_ASSERT, and mMatrix.
void lama::Matrix::setReplicatedMatrix | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) | [protected, inherited] |
Set the global/local size of replicated matrix.
[in] | numRows | number of rows, must be non-negative. |
[in] | numColumns | number of columns, must be non-negative. |
References lama::Matrix::setDistributedMatrix().
Referenced by lama::DenseMatrix< T >::allocate(), lama::DenseMatrix< T >::assign(), lama::DenseMatrix< T >::clear(), and lama::DenseMatrix< T >::DenseMatrix().
void lama::Distributed::swap | ( | Distributed & | other | ) | [protected, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::Matrix::swapMatrix().
void lama::Matrix::swapMatrix | ( | Matrix & | other | ) | [protected, inherited] |
References lama::Matrix::mColDistribution, lama::Matrix::mNumColumns, lama::Matrix::mNumRows, and lama::Distributed::swap().
Referenced by lama::DenseMatrix< T >::swap().
void lama::MetaMatrix::wait | ( | ) | const [virtual] |
void lama::Matrix::writeAt | ( | std::ostream & | stream | ) | const [virtual, inherited] |
Write some information about this to the passed stream.
[out] | stream | the stream to write to. |
Reimplemented from Printable.
Reimplemented in lama::SparseMatrix< T >, lama::SparseMatrix< ValueType >, and lama::DenseMatrix< T >.
References lama::Matrix::mNumColumns, and lama::Matrix::mNumRows.
DistributionPtr lama::Matrix::mColDistribution [protected, inherited] |
MatrixPtr lama::MetaMatrix::mMatrix [private] |
Referenced by allocate(), assign(), buildLocalStorage(), clear(), copy(), create(), getContextPtr(), getDiagonal(), getLocalNumColumns(), getLocalNumRows(), getLocalNumValues(), getMatrixKind(), getMemoryUsage(), getNumValues(), getRow(), getTypeName(), getValue(), getValueType(), hasDiagonalProperty(), invert(), matrixTimesMatrix(), matrixTimesScalar(), matrixTimesVector(), maxDiffNorm(), parseConfiguration(), prefetch(), redistribute(), resetDiagonalProperty(), scale(), setContext(), setDiagonal(), setIdentity(), and wait().
IndexType lama::Matrix::mNumColumns [protected, inherited] |
IndexType lama::Matrix::mNumRows [protected, inherited] |