LAMA
|
Definition of a derived class for SparseMatrix that uses the JDS storage format for the local and halo data of the distributed sparse matrix. More...
#include <JDSSparseMatrix.hpp>
Public Types | |
typedef T | ValueType |
type definition of the value type. | |
typedef JDSStorage< T > | StorageType |
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 | |
JDSSparseMatrix () | |
Default constructor, creates a replicated matrix of size 0 x 0. | |
JDSSparseMatrix (const IndexType numRows, const IndexType numColumns) | |
Constructor, creates a replicated zero-matrix of size numRows x numColums. | |
JDSSparseMatrix (DistributionPtr rowDist, DistributionPtr colDist) | |
Constructor, creates a distributed zero-matrix by given row and column distribution. | |
JDSSparseMatrix (const Matrix &other, bool transposeFlag=false) | |
JDSSparseMatrix (const Matrix &other, DistributionPtr rowDist, DistributionPtr colDist) | |
JDSSparseMatrix (const _MatrixStorage &localData, DistributionPtr rowDist, DistributionPtr colDist) | |
Constructor of a sparse matrix by local storage. | |
JDSSparseMatrix (const std::string &filename) | |
Constructor of a replicated sparse matrix by reading the matrix data from a file. | |
JDSSparseMatrix (const Expression< Matrix, Matrix, Times > &expression) | |
JDSSparseMatrix (const Expression< Scalar, Matrix, Times > &expression) | |
JDSSparseMatrix (const Expression< Scalar, Expression< Matrix, Matrix, Times >, Times > &expression) | |
template<typename LocalValueType , typename HaloValueType > | |
JDSSparseMatrix (const IndexType numLocalRows, const IndexType numLocalNonZeros, const IndexType numHaloNonZeros, const IndexType localIA[], const IndexType localJA[], const LocalValueType localValues[], const IndexType haloIA[], const IndexType haloJA[], const HaloValueType haloValues[], const std::vector< IndexType > &ownedIndexes, const CommunicatorPtr communicator) | |
Constructor of a JDS sparse matrix with distributed JDS storage data. | |
virtual const StorageType & | getLocalStorage () const |
Override MatrixStorage<ValueType>::getLocalStorage with covariant return type. | |
virtual StorageType & | getLocalStorage () |
virtual const StorageType & | getHaloStorage () const |
Override MatrixStorage<ValueType>::getHaloStorage with covariant return type. | |
virtual void | swapLocalStorage (StorageType &localStorage) |
Swap local storage data, allows consistent write access to local storage. | |
virtual const char * | getTypeName () const |
Override Matrix::getTypeName with correct method. | |
template<> | |
const char * | typeName () |
Getter for the type name of the class. | |
template<> | |
const char * | typeName () |
Getter for the type name of the class. | |
virtual void | invert (const Matrix &other) |
Implementation of Matrix::invert for sparse matrices. | |
virtual void | setContext (const ContextPtr context) |
specifies on which compute back end the matrix operations should take place. | |
virtual void | setContext (const ContextPtr localContext, const ContextPtr haloContext) |
Only sparse matrices will override this method, others will ignore second argument. | |
virtual ContextPtr | getContextPtr () const |
Getter routine for the context. | |
virtual const Context & | getContext () const |
template<typename OtherValueType > | |
void | setRawDenseData (const IndexType numRows, const IndexType numColumns, const OtherValueType values[], const OtherValueType eps=0.0) |
Set sparse matrix with global dense data. | |
virtual void | clear () |
Implementation of pure method. | |
virtual void | allocate (const IndexType numRows, const IndexType numColumns) |
Implementation of pure method of class Matrix. | |
virtual void | allocate (DistributionPtr distribution, DistributionPtr colDistribution) |
Implementation of pure method of class Matrix. | |
virtual void | setIdentity () |
Implementation of pure method of class Matrix. | |
virtual void | assign (const Matrix &other) |
Implementation of pure method of class Matrix. | |
void | assign (const _SparseMatrix &matrix) |
Method that assigns a sparse matrix, specialization of assign( const Matrix& ) | |
void | assign (const _MatrixStorage &other) |
Setting (distributed) matrix with any global matrix storage. | |
void | assign (const _MatrixStorage &storage, DistributionPtr rowDist, DistributionPtr colDist) |
Setting (distributed) matrix with any local matrix data. | |
virtual void | buildLocalStorage (_MatrixStorage &storage) const |
Implementation of Matrix::buildLocalStorage. | |
void | swap (SparseMatrix< ValueType > &other) |
Swap will swap all member variables of the two sparse matrices. | |
virtual void | getDiagonal (Vector &diagonal) const |
This method returns the diagonal. | |
virtual void | getRow (Vector &row, const IndexType globalRowIndex) const |
This method returns one row of the matrix. | |
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 void | matrixTimesScalar (const Matrix &other, const Scalar alpha) |
Set local data of the matrix. | |
void | matrixTimesVectorImpl (DenseVector< ValueType > &result, const ValueType alpha, const DenseVector< ValueType > &x, const ValueType beta, const DenseVector< ValueType > &y) const |
virtual void | matrixTimesVectorNImpl (DenseMatrix< ValueType > &result, const ValueType alpha, const DenseMatrix< ValueType > &x, const ValueType beta, const DenseMatrix< ValueType > &y) const |
matrix times matrix for multiple dense vectors. | |
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 | matrixTimesMatrix (Matrix &result, const Scalar alpha, const Matrix &B, const Scalar beta, const Matrix &C) const |
Implemenation of abstract method Matrix::matrixTimesMatrix. | |
Scalar | maxDiffNorm (const Matrix &other) const |
Implementation of Matrix::maxDiffNorm for sparse matrices. | |
ValueType | maxDiffNormImpl (const SparseMatrix< ValueType > &other) const |
Get the maximal difference between two elements for sparse matrices of same type. | |
IndexType | getLocalNumValues () const |
Getter routine for the number of locally stored values. | |
IndexType | getLocalNumRows () const |
Getter routine for the local number of rows. | |
IndexType | getLocalNumColumns () const |
Getter routine for the local number of rows and columns. | |
virtual IndexType | getNumValues () const |
Get the total number of non-zero values in the matrix. | |
IndexType | getPartitialNumValues () const |
Scalar | getValue (IndexType i, IndexType j) const |
returns a copy of the value at the passed global indexes. | |
const Halo & | getHalo () const |
Read access to the halo of the distributed matrix. | |
virtual void | writeAt (std::ostream &stream) const |
Write some information about this to the passed stream. | |
virtual void | prefetch () const |
Prefetch matrix data to its 'preferred' context location. | |
virtual void | wait () const |
wait for a possibly running prefetch. | |
virtual void | setComputeKind (SyncKind computeKind) |
set the compute kind. | |
virtual bool | hasDiagonalProperty () const |
hasDiagonalProperty returns the diagonalProperty of the local storage. | |
virtual void | resetDiagonalProperty () |
resetDiagonalProperty rechecks the storages for their diagonal property | |
virtual Scalar::ScalarType | getValueType () const |
Query the value type of the matrix elements, e.g. | |
virtual std::auto_ptr< Matrix > | create () const |
Constructor function which creates a 'zero' matrix of same type as a given 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. | |
virtual std::auto_ptr< Matrix > | copy () const |
Implementation of pure method. | |
void | redistribute (DistributionPtr rowDistribution, DistributionPtr colDistribution) |
This method allows any arbitrary redistribution of the matrix. | |
void | assignTranspose (const Matrix &matrix) |
Assign another matrix transposed to this matrix. | |
virtual size_t | getMemoryUsage () const |
getMemoryUsage returns the global memory that is allocated to hold this matrix. | |
void | writeToFile (const std::string &fileName, const File::FileType fileType=File::BINARY, const File::DataType dataType=File::INTERNAL, const File::IndexDataType indexDataTypeIA=File::INT, const File::IndexDataType indexDataTypeJA=File::INT) const |
Writes this sparse matrix to a file in CSR format. | |
void | readFromFile (const std::string &filename) |
Assigns this matrix with a replicated sparse matrix read from file. | |
Matrix::MatrixKind | getMatrixKind () const |
Copy constructor of a matrix with a new row and column distribution. | |
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. | |
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. | |
SyncKind | getCommunicationKind () const |
get the communication kind. | |
SyncKind | getComputeKind () const |
get the compute kind. | |
void | setCommunicationKind (SyncKind communicationKind) |
set the communication kind. | |
void | inheritAttributes (const Matrix &other) |
Inherit context and kind arguments from another 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 |
Static Public Member Functions | |
static const char * | typeName () |
Static method that returns the name of the matrix class. | |
Protected Member Functions | |
void | swap (Distributed &other) |
void | checkSettings () |
Test consistency of sparse matrix data, only used if ASSERT_DEBUG is enabled. | |
void | matrixTimesMatrixImpl (const ValueType alpha, const SparseMatrix< ValueType > &A, const SparseMatrix< ValueType > &B, const ValueType beta, const SparseMatrix< ValueType > &C) |
Set this matrix = alpha * A * B + beta * C. | |
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 | swapMatrix (Matrix &other) |
void | setDistributionPtr (DistributionPtr distributionPtr) |
Protected Attributes | |
boost::shared_ptr < MatrixStorage< ValueType > > | mLocalData |
local columns of sparse matrix | |
boost::shared_ptr < MatrixStorage< ValueType > > | mHaloData |
local columns of sparse matrix | |
Halo | mHalo |
Exchange plans for halo part due to column distribution. | |
DistributionPtr | mColDistribution |
IndexType | mNumRows |
IndexType | mNumColumns |
Private Member Functions | |
boost::shared_ptr < MatrixStorage< ValueType > > | createStorage () |
This private routine provides empty JDS storage for a JDSSparseMatrix. | |
boost::shared_ptr < MatrixStorage< ValueType > > | createStorage (const IndexType numRows, const IndexType numColumns) |
LAMA_LOG_DECL_STATIC_LOGGER (logger) |
Definition of a derived class for SparseMatrix that uses the JDS storage format for the local and halo data of the distributed sparse matrix.
As the storage format is known here this class can offer more advanced constructors that do not exist for SparseMatrix as there the storage format is not fixed.
typedef const Matrix& lama::Matrix::ExpressionMemberType [inherited] |
ExpressionMemberType is the type that is used the template Expression to store a Vector.
typedef JDSStorage<T> lama::JDSSparseMatrix< T >::StorageType |
typedef T lama::JDSSparseMatrix< T >::ValueType |
type definition of the value type.
Reimplemented from lama::SparseMatrix< T >.
enum lama::Matrix::MatrixKind [inherited] |
enum lama::Matrix::SyncKind [inherited] |
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | ) | [inline] |
Default constructor, creates a replicated matrix of size 0 x 0.
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) | [inline] |
Constructor, creates a replicated zero-matrix of size numRows x numColums.
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | DistributionPtr | rowDist, |
DistributionPtr | colDist | ||
) | [inline] |
Constructor, creates a distributed zero-matrix by given row and column distribution.
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const Matrix & | other, |
bool | transposeFlag = false |
||
) | [inline] |
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const Matrix & | other, |
DistributionPtr | rowDist, | ||
DistributionPtr | colDist | ||
) | [inline] |
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const _MatrixStorage & | localData, |
DistributionPtr | rowDist, | ||
DistributionPtr | colDist | ||
) | [inline] |
Constructor of a sparse matrix by local storage.
[in] | localData | contains local rows of the distributed matrix |
[in] | rowDist | is distribution of localData |
[in] | colDist | specifies how to split local rows for halo |
This constructor works also fine if localData is the full global matrix; in this case only local rows will be taken on this processor.
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const std::string & | filename | ) | [inline] |
Constructor of a replicated sparse matrix by reading the matrix data from a file.
Next releases will also support distributed/parallel I/O. In the meantime this constructor should be used with a following call of the redistribute method.
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const Expression< Matrix, Matrix, Times > & | expression | ) | [inline] |
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const Expression< Scalar, Matrix, Times > & | expression | ) | [inline] |
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const Expression< Scalar, Expression< Matrix, Matrix, Times >, Times > & | expression | ) | [inline] |
lama::JDSSparseMatrix< T >::JDSSparseMatrix | ( | const IndexType | numLocalRows, |
const IndexType | numLocalNonZeros, | ||
const IndexType | numHaloNonZeros, | ||
const IndexType | localIA[], | ||
const IndexType | localJA[], | ||
const LocalValueType | localValues[], | ||
const IndexType | haloIA[], | ||
const IndexType | haloJA[], | ||
const HaloValueType | haloValues[], | ||
const std::vector< IndexType > & | ownedIndexes, | ||
const CommunicatorPtr | communicator | ||
) | [inline] |
Constructor of a JDS sparse matrix with distributed JDS storage data.
[in] | numRows | the number of rows of the matrix |
[in] | numLocalNonZeros | the number of local none zeros of the matrix |
[in] | numHaloNonZeros | the number of halo none zeros of the matrix |
[in] | localIA | row pointer of the input csr sparse matrix (local) |
[in] | localJA | column indexes of the input csr sparse matrix (local) |
[in] | localValues | the none zero values of the input csr sparse matrix (local) |
[in] | haloIA | row pointer of the input csr sparse matrix (halo) |
[in] | haloJA | column indexes of the input csr sparse matrix (halo) |
[in] | haloValues | the none zero values of the input csr sparse matrix (halo) |
[in] | globalIndexes | the global Indexes of the local rows |
[in] | communicator | communicator of the distribution |
References lama::Matrix::setDistributedMatrix().
void lama::SparseMatrix< ValueType >::allocate | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) | [virtual, inherited] |
Implementation of pure method of class Matrix.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
Referenced by lama::MatrixCreator< T >::buildRandom().
void lama::SparseMatrix< ValueType >::allocate | ( | DistributionPtr | distribution, |
DistributionPtr | colDistribution | ||
) | [virtual, inherited] |
Implementation of pure method of class Matrix.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
void lama::SparseMatrix< ValueType >::assign | ( | const Matrix & | other | ) | [virtual, inherited] |
Implementation of pure method of class Matrix.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Matrix::buildLocalStorage(), lama::Matrix::getColDistributionPtr(), lama::Matrix::getContextPtr(), and lama::Distributed::getDistributionPtr().
Referenced by lama::MatrixCreator< T >::buildPoisson().
void lama::SparseMatrix< ValueType >::assign | ( | const _SparseMatrix< T > & | matrix | ) | [inherited] |
Method that assigns a sparse matrix, specialization of assign( const Matrix& )
References lama::Matrix::getColDistributionPtr(), lama::Distributed::getDistributionPtr(), lama::_SparseMatrix::getHalo(), lama::_SparseMatrix::getHaloStorage(), and lama::_SparseMatrix::getLocalStorage().
void lama::SparseMatrix< ValueType >::assign | ( | const _MatrixStorage & | other | ) | [virtual, inherited] |
Setting (distributed) matrix with any global matrix storage.
[in] | other | is replicated (sparse) matrix data containing all values to be set |
Size of other matrix must be exactly the same as this matrix. This routine might imply type and storage format conversions as well as distributing the data according to the current distribution of this matrix.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::_MatrixStorage::getNumColumns(), and lama::_MatrixStorage::getNumRows().
void lama::SparseMatrix< ValueType >::assign | ( | const _MatrixStorage & | storage, |
DistributionPtr | rowDist, | ||
DistributionPtr | colDist | ||
) | [virtual, inherited] |
Setting (distributed) matrix with any local matrix data.
[in] | other | is local (sparse) matrix data containing all values to be set |
Size of other matrix must be exactly the same as this matrix. This routine might imply type and storage format changes.
void assignLocal( const _MatrixStorage& { LAMA_THROWEXCEPTION( "not available yet" ); } Assignment of local storage that fits a given row distribution. The columns of the local storage will be splitted according to the column distribution.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::MatrixStorage< T >::assign(), lama::_MatrixStorage::getNumColumns(), lama::_MatrixStorage::getNumRows(), LAMA_ASSERT_EQUAL_ERROR, and LAMA_THROWEXCEPTION.
void lama::SparseMatrix< ValueType >::assignTranspose | ( | const Matrix & | matrix | ) | [inherited] |
Assign another matrix transposed to this matrix.
References LAMA_THROWEXCEPTION.
void lama::SparseMatrix< ValueType >::buildLocalStorage | ( | _MatrixStorage & | storage | ) | const [virtual, inherited] |
Implementation of Matrix::buildLocalStorage.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
void lama::SparseMatrix< ValueType >::checkSettings | ( | ) | [protected, inherited] |
Test consistency of sparse matrix data, only used if ASSERT_DEBUG is enabled.
Reimplemented from lama::Matrix.
References LAMA_ASSERT_EQUAL_DEBUG.
void lama::SparseMatrix< ValueType >::clear | ( | ) | [virtual, inherited] |
Implementation of pure method.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
std::auto_ptr< Matrix > lama::SparseMatrix< ValueType >::copy | ( | ) | const [virtual, inherited] |
Implementation of pure method.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
std::auto_ptr< Matrix > lama::SparseMatrix< ValueType >::create | ( | ) | const [virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::SparseMatrix< T >::setContext().
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.
boost::shared_ptr<MatrixStorage< ValueType> > lama::JDSSparseMatrix< T >::createStorage | ( | ) | [inline, private] |
This private routine provides empty JDS storage for a JDSSparseMatrix.
boost::shared_ptr<MatrixStorage< ValueType> > lama::JDSSparseMatrix< T >::createStorage | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) | [inline, private] |
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().
virtual const Context& lama::SparseMatrix< T >::getContext | ( | ) | const [inline, virtual, inherited] |
Reimplemented from lama::Matrix.
virtual ContextPtr lama::SparseMatrix< T >::getContextPtr | ( | ) | const [inline, virtual, inherited] |
Getter routine for the context.
Note: Only for SparseMatrix the context of the halo can be queried.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
void lama::SparseMatrix< ValueType >::getDiagonal | ( | Vector & | diagonal | ) | const [virtual, inherited] |
This method returns the diagonal.
[out] | diagonal | is the destination array |
Calculations are dependent to the diagonal property
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References LAMA_THROWEXCEPTION, lama::Vector::resize(), and lama::Vector::setValues().
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().
const Halo & lama::SparseMatrix< ValueType >::getHalo | ( | ) | const [virtual, inherited] |
Read access to the halo of the distributed matrix.
Implements lama::_SparseMatrix.
Referenced by lama::SparseMatrix< T >::assignTransposeImpl(), lama::SOR::iterateImpl(), lama::SpecializedJacobi::iterateTyped(), lama::SparseMatrix< T >::matrixTimesMatrixImpl(), and lama::SparseMatrix< T >::SparseMatrix().
const JDSSparseMatrix< ValueType >::StorageType & lama::JDSSparseMatrix< ValueType >::getHaloStorage | ( | ) | const [virtual] |
Override MatrixStorage<ValueType>::getHaloStorage with covariant return type.
Reimplemented from lama::SparseMatrix< T >.
References LAMA_ASSERT_ERROR.
IndexType lama::SparseMatrix< ValueType >::getLocalNumColumns | ( | ) | const [virtual, inherited] |
Getter routine for the local number of rows and columns.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Matrix::getNumColumns().
IndexType lama::SparseMatrix< ValueType >::getLocalNumRows | ( | ) | const [virtual, inherited] |
Getter routine for the local number of rows.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Matrix::getNumRows().
IndexType lama::SparseMatrix< ValueType >::getLocalNumValues | ( | ) | const [virtual, inherited] |
Getter routine for the number of locally stored values.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::SparseMatrix< T >::getNumValues().
const JDSSparseMatrix< ValueType >::StorageType & lama::JDSSparseMatrix< ValueType >::getLocalStorage | ( | ) | const [virtual] |
Override MatrixStorage<ValueType>::getLocalStorage with covariant return type.
Reimplemented from lama::SparseMatrix< T >.
References LAMA_ASSERT_ERROR.
JDSSparseMatrix< ValueType >::StorageType & lama::JDSSparseMatrix< ValueType >::getLocalStorage | ( | ) | [virtual] |
References LAMA_ASSERT_ERROR.
Matrix::MatrixKind lama::_SparseMatrix::getMatrixKind | ( | ) | const [inline, virtual, inherited] |
Copy constructor of a matrix with a new row and column distribution.
_SparseMatrix( const Matrix& other, DistributionPtr distribution, DistributionPtr colDistribution ) :
Matrix( other, distribution, colDistribution ) {} Implementation of pure method Matrix::getMatrixKind
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Matrix::SPARSE.
size_t lama::SparseMatrix< ValueType >::getMemoryUsage | ( | ) | const [virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::SparseMatrix< T >::getMemoryUsage().
Referenced by lama::SparseMatrix< T >::getMemoryUsage().
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::SparseMatrix< ValueType >::getNumValues | ( | ) | const [virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
Referenced by lama::SparseMatrix< T >::getLocalNumValues(), and lama::SparseMatrix< T >::getPartitialNumValues().
IndexType lama::SparseMatrix< ValueType >::getPartitialNumValues | ( | ) | const [inherited] |
References lama::SparseMatrix< T >::getNumValues().
void lama::SparseMatrix< ValueType >::getRow | ( | Vector & | row, |
const IndexType | globalRowIndex | ||
) | const [virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Communicator::bcast(), lama::Distributed::getDistribution(), lama::Communicator::getRank(), lama::Distribution::isReplicated(), LAMA_ASSERT_ERROR, lama::nIndex, and lama::Communicator::sum().
double lama::Matrix::getSparsityRate | ( | ) | const [inherited] |
References lama::Matrix::getNumValues(), lama::Matrix::mNumColumns, and lama::Matrix::mNumRows.
const char * lama::JDSSparseMatrix< ValueType >::getTypeName | ( | ) | const [virtual] |
Override Matrix::getTypeName with correct method.
Reimplemented from lama::SparseMatrix< T >.
Scalar lama::SparseMatrix< ValueType >::getValue | ( | IndexType | i, |
IndexType | j | ||
) | const [virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Distribution::getCommunicator(), lama::Distribution::global2local(), lama::nIndex, and lama::Communicator::sum().
Scalar::ScalarType lama::SparseMatrix< ValueType >::getValueType | ( | ) | const [virtual, inherited] |
Query the value type of the matrix elements, e.g.
DOUBLE or FLOAT.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
bool lama::SparseMatrix< ValueType >::hasDiagonalProperty | ( | ) | const [virtual, inherited] |
hasDiagonalProperty returns the diagonalProperty of the local storage.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
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::SparseMatrix< ValueType >::invert | ( | const Matrix & | other | ) | [virtual, inherited] |
Implementation of Matrix::invert for sparse matrices.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::DenseMatrix< T >::invert(), and LAMA_UNSUPPORTED.
lama::JDSSparseMatrix< T >::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [private] |
Reimplemented from lama::SparseMatrix< T >.
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::SparseMatrix< ValueType >::matrixTimesMatrix | ( | Matrix & | result, |
const Scalar | alpha, | ||
const Matrix & | B, | ||
const Scalar | beta, | ||
const Matrix & | C | ||
) | const [virtual, inherited] |
Implemenation of abstract method Matrix::matrixTimesMatrix.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::DENSE, lama::Matrix::getMatrixKind(), lama::Scalar::getValue(), LAMA_ASSERT_ERROR, and lama::SparseMatrix< T >::matrixTimesMatrixImpl().
void lama::SparseMatrix< ValueType >::matrixTimesMatrixImpl | ( | const ValueType | alpha, |
const SparseMatrix< ValueType > & | A, | ||
const SparseMatrix< ValueType > & | B, | ||
const ValueType | beta, | ||
const SparseMatrix< ValueType > & | C | ||
) | [protected, inherited] |
Set this matrix = alpha * A * B + beta * C.
References lama::MatrixStorage< T >::exchangeHalo(), lama::Matrix::getColDistribution(), lama::Matrix::getColDistributionPtr(), lama::Distribution::getCommunicator(), lama::Distributed::getDistribution(), lama::Distributed::getDistributionPtr(), lama::SparseMatrix< T >::getHalo(), lama::SparseMatrix< T >::getLocalStorage(), lama::Distribution::isReplicated(), LAMA_ASSERT_EQUAL_DEBUG, LAMA_ASSERT_ERROR, LAMA_THROWEXCEPTION, lama::SparseMatrix< T >::mHaloData, and lama::SparseMatrix< T >::mLocalData.
Referenced by lama::SparseMatrix< T >::matrixTimesMatrix().
void lama::SparseMatrix< ValueType >::matrixTimesScalar | ( | const Matrix & | other, |
const Scalar | alpha | ||
) | [virtual, inherited] |
Set local data of the matrix.
The local part of the distributed matrix will be splitted into local / halo part. corresponding to the column distribution, builds new halo this matrix = other * alpha
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Scalar::getValue().
void lama::SparseMatrix< ValueType >::matrixTimesVector | ( | Vector & | result, |
const Scalar | alpha, | ||
const Vector & | x, | ||
const Scalar | beta, | ||
const Vector & | y | ||
) | const [virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Distributed::getDistribution(), lama::Scalar::getValue(), LAMA_ASSERT, LAMA_ASSERT_EQUAL, LAMA_REGION, LAMA_THROWEXCEPTION, and lama::Vector::resize().
void lama::SparseMatrix< ValueType >::matrixTimesVectorImpl | ( | DenseVector< ValueType > & | result, |
const ValueType | alpha, | ||
const DenseVector< ValueType > & | x, | ||
const ValueType | beta, | ||
const DenseVector< ValueType > & | y | ||
) | const [inherited] |
void lama::SparseMatrix< ValueType >::matrixTimesVectorNImpl | ( | DenseMatrix< ValueType > & | result, |
const ValueType | alpha, | ||
const DenseMatrix< ValueType > & | x, | ||
const ValueType | beta, | ||
const DenseMatrix< ValueType > & | y | ||
) | const [virtual, inherited] |
matrix times matrix for multiple dense vectors.
References lama::DenseMatrix< T >::allocate(), lama::Matrix::getColDistribution(), lama::Matrix::getColDistributionPtr(), lama::Distributed::getDistribution(), lama::DenseMatrix< T >::getLocalStorage(), LAMA_ASSERT, and LAMA_ASSERT_DEBUG.
Scalar lama::SparseMatrix< ValueType >::maxDiffNorm | ( | const Matrix & | other | ) | const [virtual, inherited] |
Implementation of Matrix::maxDiffNorm for sparse matrices.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Matrix::getColDistribution(), lama::Distributed::getDistribution(), lama::Matrix::getValueType(), lama::Distribution::isReplicated(), LAMA_ASSERT_DEBUG, LAMA_THROWEXCEPTION, and LAMA_UNSUPPORTED.
ValueType lama::SparseMatrix< ValueType >::maxDiffNormImpl | ( | const SparseMatrix< ValueType > & | other | ) | const [inherited] |
Get the maximal difference between two elements for sparse matrices of same type.
References lama::Matrix::getColDistribution(), lama::Distributed::getDistribution(), lama::SparseMatrix< T >::getLocalStorage(), lama::Distribution::isReplicated(), LAMA_ASSERT_EQUAL_ERROR, LAMA_ASSERT_ERROR, and lama::Communicator::max().
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::SparseMatrix< ValueType >::prefetch | ( | ) | const [virtual, inherited] |
Prefetch matrix data to its 'preferred' context location.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::SparseMatrix< T >::prefetch().
Referenced by lama::SparseMatrix< T >::prefetch().
void lama::SparseMatrix< ValueType >::readFromFile | ( | const std::string & | filename | ) | [inherited] |
Assigns this matrix with a replicated sparse matrix read from file.
Creates a replicated sparse matrix read from file. Currently supported is the matrix market format, XDR, formatted, unformatted, binary.
ToDo: set reference to description in StorageIO.
[in] | filename | the filename to read from |
Note: Derived classes might use this routine within a constructor for convenience. This class does not support such a constructor as no file format is known.
void lama::SparseMatrix< ValueType >::redistribute | ( | DistributionPtr | rowDistribution, |
DistributionPtr | colDistribution | ||
) | [virtual, inherited] |
This method allows any arbitrary redistribution of the matrix.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References LAMA_ASSERT_ERROR.
void lama::SparseMatrix< ValueType >::resetDiagonalProperty | ( | ) | [virtual, inherited] |
resetDiagonalProperty rechecks the storages for their diagonal property
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References LAMA_THROWEXCEPTION.
void lama::SparseMatrix< ValueType >::scale | ( | const Vector & | scaling | ) | [virtual, inherited] |
This method scales all values with a vector.
[in] | scaling | is the vector with scale value for each row |
row wise calculations
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Vector::buildValues(), lama::Distributed::getDistribution(), and LAMA_THROWEXCEPTION.
void lama::SparseMatrix< ValueType >::scale | ( | const Scalar | scaling | ) | [virtual, inherited] |
This method scales all matrix values with a scalar.
[in] | value | is the source value |
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References LAMA_THROWEXCEPTION.
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::SparseMatrix< ValueType >::setComputeKind | ( | SyncKind | computeKind | ) | [virtual, inherited] |
set the compute kind.
[in] | computeKind | the compute kind. |
Reimplemented from lama::Matrix.
References lama::WriteAccess< T >::reserve().
virtual void lama::SparseMatrix< T >::setContext | ( | const ContextPtr | context | ) | [inline, virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
Referenced by lama::SparseMatrix< T >::create().
virtual void lama::SparseMatrix< T >::setContext | ( | const ContextPtr | localContext, |
const ContextPtr | haloContext | ||
) | [inline, virtual, inherited] |
Only sparse matrices will override this method, others will ignore second argument.
Reimplemented from lama::Matrix.
void lama::SparseMatrix< ValueType >::setDiagonal | ( | const Vector & | diagonal | ) | [virtual, inherited] |
This method replaces the diagonal.
[in] | diagonal | is the source array |
Calculations are dependent to the diagonal property
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::Vector::buildValues(), lama::Distributed::getDistribution(), and LAMA_THROWEXCEPTION.
void lama::SparseMatrix< ValueType >::setDiagonal | ( | const Scalar | scalar | ) | [virtual, inherited] |
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.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References LAMA_THROWEXCEPTION.
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::SparseMatrix< ValueType >::setIdentity | ( | ) | [virtual, inherited] |
Implementation of pure method of class Matrix.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References LAMA_THROWEXCEPTION.
void lama::SparseMatrix< ValueType >::setRawDenseData | ( | const IndexType | numRows, |
const IndexType | numColumns, | ||
const OtherValueType | values[], | ||
const OtherValueType | eps = 0.0 |
||
) | [inherited] |
Set sparse matrix with global dense data.
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::SparseMatrix< ValueType >::swap | ( | SparseMatrix< ValueType > & | other | ) | [inherited] |
Swap will swap all member variables of the two sparse matrices.
This operation might be useful in iteration loops where a sparse matrix is updated each iteration. It is more convenient than a solution that is based on using pointers in the application.
References lama::SparseMatrix< T >::mHalo, lama::SparseMatrix< T >::mHaloData, and lama::SparseMatrix< T >::mLocalData.
void lama::JDSSparseMatrix< ValueType >::swapLocalStorage | ( | StorageType & | localStorage | ) | [virtual] |
Swap local storage data, allows consistent write access to local storage.
References lama::_MatrixStorage::getNumColumns(), lama::_MatrixStorage::getNumRows(), LAMA_ASSERT_EQUAL_ERROR, and LAMA_ASSERT_ERROR.
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().
static const char* lama::JDSSparseMatrix< T >::typeName | ( | ) | [static] |
Static method that returns the name of the matrix class.
Reimplemented from lama::SparseMatrix< T >.
const char * lama::JDSSparseMatrix< float >::typeName | ( | ) |
Getter for the type name of the class.
Reimplemented from lama::SparseMatrix< T >.
const char * lama::JDSSparseMatrix< double >::typeName | ( | ) |
Getter for the type name of the class.
Reimplemented from lama::SparseMatrix< T >.
void lama::SparseMatrix< ValueType >::wait | ( | ) | const [virtual, inherited] |
wait for a possibly running prefetch.
Implements lama::Matrix.
Reimplemented in lama::SimpleStorageStrategy< ValueType >.
References lama::SparseMatrix< T >::wait().
Referenced by lama::SparseMatrix< T >::wait().
void lama::SparseMatrix< ValueType >::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 lama::Matrix.
void lama::SparseMatrix< ValueType >::writeToFile | ( | const std::string & | fileName, |
const File::FileType | fileType = File::BINARY , |
||
const File::DataType | dataType = File::INTERNAL , |
||
const File::IndexDataType | indexDataTypeIA = File::INT , |
||
const File::IndexDataType | indexDataTypeJA = File::INT |
||
) | const [inherited] |
Writes this sparse matrix to a file in CSR format.
References lama::Communicator::getRank(), lama::Communicator::getSize(), lama::MatrixStorage< T >::joinHalo(), LAMA_THROWEXCEPTION, lama::Communicator::synchronize(), and lama::MatrixStorage< T >::writeToFile().
DistributionPtr lama::Matrix::mColDistribution [protected, inherited] |
Halo lama::SparseMatrix< T >::mHalo [protected, inherited] |
Exchange plans for halo part due to column distribution.
Referenced by lama::SparseMatrix< T >::SparseMatrix(), and lama::SparseMatrix< T >::swap().
boost::shared_ptr<MatrixStorage<ValueType> > lama::SparseMatrix< T >::mHaloData [protected, inherited] |
local columns of sparse matrix
Referenced by lama::SparseMatrix< T >::matrixTimesMatrixImpl(), lama::SparseMatrix< T >::SparseMatrix(), and lama::SparseMatrix< T >::swap().
boost::shared_ptr<MatrixStorage<ValueType> > lama::SparseMatrix< T >::mLocalData [protected, inherited] |
local columns of sparse matrix
Referenced by lama::SparseMatrix< T >::matrixTimesMatrixImpl(), and lama::SparseMatrix< T >::swap().
IndexType lama::Matrix::mNumColumns [protected, inherited] |
IndexType lama::Matrix::mNumRows [protected, inherited] |