LAMA
|
Class for dense matrices where rows are distributed among rows and columns are splitted according to a column distribution. More...
#include <DenseMatrix.hpp>
Public Types | |
typedef T | ValueType |
typedef boost::shared_ptr < DenseStorage< T > > | DenseStoragePtr |
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 | |
DenseMatrix () | |
Default constructor. | |
DenseMatrix (const IndexType numRows, const IndexType numColumns) | |
Constructor of a replicated dense matrix. | |
DenseMatrix (DistributionPtr rowDist, DistributionPtr colDist) | |
Constructor of a distributed dense matrix. | |
DenseMatrix (DistributionPtr dist) | |
Construct a square unity matrix. | |
DenseMatrix (const DenseMatrix< ValueType > &other) | |
Overwrite default copy constructor so it uses other copy constructor. | |
DenseMatrix (const Matrix &other) | |
Construct a dense matrix from any other matrix that can be of a different type. | |
DenseMatrix (const Matrix &other, DistributionPtr distribution, DistributionPtr colDistribution) | |
Construct a dense matrix from any other matrix with new distributions. | |
DenseMatrix (const DenseMatrix< ValueType > &matrix, DistributionPtr distribution, DistributionPtr colDistribution) | |
DenseMatrix (const _MatrixStorage &localData, DistributionPtr rowDist, DistributionPtr colDist) | |
Constructor of a dense matrix by local storage. | |
template<typename OtherValueType > | |
DenseMatrix (const IndexType numRows, const IndexType numColumns, const IndexType numNoneZeros, const IndexType *const ia, const IndexType *const ja, const OtherValueType *const values) | |
Creates a replicated dense matrix from the passed csr sparse matrix. | |
DenseMatrix (const Expression< Expression< Scalar, Expression< Matrix, Matrix, Times >, Times >, Expression< Scalar, Matrix, Times >, Plus > expression) | |
DenseMatrix (const Expression< Matrix, Matrix, Times > expression) | |
DenseMatrix (const Expression< Scalar, Expression< Matrix, Matrix, Times >, Times > expression) | |
DenseMatrix (const Expression< Scalar, Matrix, Times > expression) | |
DenseMatrix (const std::string &filename) | |
Constructor of a replicated dense matrix by reading the matrix data from a file. | |
virtual | ~DenseMatrix () |
DenseMatrix & | operator= (const DenseMatrix &matrix) |
Override default assignment operator needed to guarantee deep copy. | |
DenseMatrix & | operator= (const Matrix &matrix) |
the assignment operator for matrix. | |
DenseMatrix & | operator= (const Expression< Scalar, Matrix, Times > expression) |
the assignment operator for a scalar matrix multiplication. | |
DenseMatrix & | operator= (const Expression< Matrix, Matrix, Times > expression) |
the assignment operator for a matrix matrix multiplication. | |
DenseMatrix & | operator= (const Expression< Scalar, Expression< Matrix, Matrix, Times >, Times > expression) |
the assignment operator for a scalar matrix matrix multiplication. | |
DenseMatrix & | operator= (const Expression< Expression< Scalar, Expression< Matrix, Matrix, Times >, Times >, Expression< Scalar, Matrix, Times >, Plus > expression) |
the assignment operator for a GEMM expression. | |
const char * | getTypeName () const |
Implementation for Matrix::getTypeName() | |
Matrix::MatrixKind | getMatrixKind () const |
Each derived matrix must give info about its kind (DENSE or SPARSE). | |
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 void | setIdentity () |
Operator that sets the matrix to the identity matrix. | |
template<typename OtherValueType > | |
void | setRawDenseData (const IndexType numRows, const IndexType numColumns, const OtherValueType values[], const OtherValueType eps=0.0) |
Set matrix with global dense data. | |
virtual void | buildCSRData (LAMAArray< IndexType > &rowIA, LAMAArray< IndexType > &rowJA, _LAMAArray &rowValues) const |
Implementation of pure method for the dense storage format. | |
virtual void | setCSRData (const LAMAArray< IndexType > &rowIA, const LAMAArray< IndexType > &rowJA, const _LAMAArray &rowValues, DistributionPtr rowDistribution, DistributionPtr colDistribution) |
Implementation of pure method. | |
void | setCSRDataLocal (const LAMAArray< IndexType > &rowIA, const LAMAArray< IndexType > &rowJA, const _LAMAArray &rowValues) const |
Local version of setCSRData . | |
virtual void | clear () |
Implementation of pure method. | |
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 | assign (const Matrix &other) |
This method assigns a matrix to this matrix with automatic conversion to the needed matrix type and the current row / column distribution of. | |
void | swap (DenseMatrix< ValueType > &other) |
Swap will swap all member variables of the two dense matrices. | |
void | assignSparse (const _SparseMatrix &other) |
void | assign (const _MatrixStorage &storage) |
Assign replicated storage for a replicated matrix. | |
void | assign (const _MatrixStorage &storage, DistributionPtr rowDist, DistributionPtr colDist) |
Assign local storage for a distributed matrix. | |
void | assignLocal (const _MatrixStorage &other) |
virtual void | buildLocalStorage (_MatrixStorage &storage) const |
Implementation of Matrix::buildLocalStorage. | |
void | redistribute (DistributionPtr rowDistribution, DistributionPtr colDistribution) |
Implementation of pure method. | |
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 diagonalValue) |
This method replaces the diagonal by a diagonal value. | |
virtual void | scale (const Vector &values) |
This method scales all values with a vector. | |
virtual void | scale (const Scalar value) |
This method scales all matrix values with a scalar. | |
Scalar | getValue (lama::IndexType i, lama::IndexType j) const |
returns a copy of the value at the passed global indexes. | |
void | matrixTimesScalar (const Matrix &other, const Scalar alpha) |
matrixTimesScalar computes this = alpha * other | |
void | matrixTimesVectorImpl (DenseVector< ValueType > &denseResult, const ValueType alphaValue, const DenseVector< ValueType > &denseX, const ValueType betaValue, const DenseVector< ValueType > &denseY) const |
Matrix times vector with same values types and correct distributions. | |
virtual void | invert (const Matrix &other) |
Set this matrix with the inverse of another square matrix. | |
void | invert () |
Invert in place. | |
Scalar | maxDiffNorm (const Matrix &other) const |
Implementation of Matrix::maxDiffNorm for dense matrices. | |
ValueType | maxDiffNormImpl (const DenseMatrix< ValueType > &other) const |
Get the maximal difference between two elements for dense matrices of same type. | |
void | matrixTimesMatrix (Matrix &result, const Scalar alpha, const Matrix &x, const Scalar beta, const Matrix &y) const |
Implementation of pure method Matrix::matrixTimesMatrix. | |
virtual void | prefetch () const |
Prefetch matrix data to its 'preferred' context location. | |
void | prefetch (lama::ContextPtr loc) const |
void | wait () const |
wait for a possibly running prefetch. | |
const DenseStorage< ValueType > & | getLocalStorage () const |
This method returns the storage containing the local data regarding row/col distribution. | |
DenseStorage< ValueType > & | getLocalStorage () |
virtual IndexType | getLocalNumValues () const |
Implementation of Matrix::getLocalNumValues, getLocalNumRows, getLocalNumColumns. | |
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 IndexType | getNumValues () const |
Get the total number of non-zero values in the matrix. | |
std::vector< DenseStoragePtr > & | getCyclicLocalValues () |
const std::vector < DenseStoragePtr > & | getCyclicLocalValues () const |
virtual bool | hasDiagonalProperty () const |
hasDiagonalProperty returns the diagonalProperty of the local storage. | |
virtual void | resetDiagonalProperty () |
resetDiagonalProperty rechecks the storages for their diagonal property | |
virtual void | writeAt (std::ostream &stream) const |
Write some information about this to the passed stream. | |
virtual Scalar::ScalarType | getValueType () const |
Query the value type of the matrix elements, e.g. | |
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 |
Method writes dense matrix to a file. | |
virtual std::auto_ptr< Matrix > | create () const |
Constructing a new object by the default constructor. | |
virtual std::auto_ptr< Matrix > | copy () const |
Constructing a new object by the copy constructor. | |
virtual size_t | getMemoryUsage () const |
getMemoryUsage returns the global memory that is allocated to hold this matrix. | |
const std::vector< PartitionId > & | getOwners () const |
template<typename OtherValueType > | |
void | getDiagonalImpl (DenseVector< OtherValueType > &diagonal) const |
template<> | |
const char * | typeName () |
template<> | |
const char * | typeName () |
template<typename OtherValueType > | |
void | copyDenseMatrix (const DenseMatrix< OtherValueType > &other) |
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 | |
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. | |
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 |
Static Public Member Functions | |
static const char * | typeName () |
Getter for the type name of the class. | |
Data Fields | |
std::vector< boost::shared_ptr < DenseStorage< ValueType > > > | mData |
local data is allocated in chunks according to column distribution | |
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 | |
std::vector< PartitionId > | mOwners |
DistributionPtr | mColDistribution |
IndexType | mNumRows |
IndexType | mNumColumns |
Private Member Functions | |
void | allocateData () |
Allocate of storage for the column blocks. | |
template<typename otherT > | |
void | copyDenseMatrix (const DenseMatrix< otherT > &other) |
Copy a dense matrix with different data type; inherits sizes and distributions. | |
template<typename OtherT > | |
void | getDiagonalImpl (DenseVector< OtherT > &diagonal) const |
Optimized implementation for dense vectors as diagonal. | |
void | redistributeRows (DistributionPtr rowDistribution) |
void | splitColumns (DistributionPtr colDistribution) |
Split the replicated columns into chunks according to the column distribution. | |
void | getRow (DenseVector< ValueType > &row, const IndexType i) const |
LAMA_LOG_DECL_STATIC_LOGGER (logger) | |
void | computeOwners () |
void | invertCyclic () |
Special implementation of invert in place for a cyclic distributed matrix. | |
Static Private Member Functions | |
static void | joinColumnData (DenseStorage< ValueType > &result, const std::vector< boost::shared_ptr< DenseStorage< ValueType > > > &chunks, const std::vector< IndexType > &columnOwners) |
Join dense storage of column distributed data. | |
static void | splitColumnData (std::vector< boost::shared_ptr< DenseStorage< ValueType > > > &chunks, const DenseStorage< ValueType > &columnData, const PartitionId numChunks, const std::vector< IndexType > &columnOwners) |
Split dense storage data according to a distribution into chunks. | |
static void | localize (DenseStorage< ValueType > &local, const DenseStorage< ValueType > &global, const Distribution &rowDistribution) |
Restrict dense storage of a replicated matrix to its local part according to row distribution. | |
Private Attributes | |
LAMAArray< ValueType > | mSendValues |
LAMAArray< ValueType > | mReceiveValues |
Class for dense matrices where rows are distributed among rows and columns are splitted according to a column distribution.
The local rows are splitted according to a column distribution into different blocks that are stored in a vector of shared pointers. A copy of this vector will not make deep copies of the blocks so default copy constructor and assignment operator must be overridden.
typedef boost::shared_ptr<DenseStorage<T> > lama::DenseMatrix< T >::DenseStoragePtr |
typedef const Matrix& lama::Matrix::ExpressionMemberType [inherited] |
ExpressionMemberType is the type that is used the template Expression to store a Vector.
typedef T lama::DenseMatrix< T >::ValueType |
enum lama::Matrix::MatrixKind [inherited] |
enum lama::Matrix::SyncKind [inherited] |
lama::DenseMatrix< ValueType >::DenseMatrix | ( | ) |
Default constructor.
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) |
Constructor of a replicated dense matrix.
References lama::DenseMatrix< T >::computeOwners(), and lama::DenseMatrix< T >::mData.
lama::DenseMatrix< ValueType >::DenseMatrix | ( | DistributionPtr | rowDist, |
DistributionPtr | colDist | ||
) |
Constructor of a distributed dense matrix.
References lama::DenseMatrix< T >::allocateData(), and lama::DenseMatrix< T >::computeOwners().
lama::DenseMatrix< ValueType >::DenseMatrix | ( | DistributionPtr | dist | ) | [explicit] |
Construct a square unity matrix.
References lama::DenseMatrix< T >::computeOwners(), lama::Distributed::getDistribution(), lama::Distribution::getLocalSize(), lama::Distribution::getNumPartitions(), lama::DenseMatrix< T >::mData, and lama::DenseMatrix< T >::mOwners.
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const DenseMatrix< ValueType > & | other | ) |
Overwrite default copy constructor so it uses other copy constructor.
Note: Default copy constructor would not make deep copies of the storages, so it must be overridden
References lama::DenseMatrix< T >::assign().
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const Matrix & | other | ) |
Construct a dense matrix from any other matrix that can be of a different type.
New dense matrix has the same size and the same distribution.
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const Matrix & | other, |
DistributionPtr | distribution, | ||
DistributionPtr | colDistribution | ||
) |
Construct a dense matrix from any other matrix with new distributions.
The following codes are equivalent:
DenseMatrix dense( other, rowDist, colDist ); // same as DenseMatrix dense( other ); dense->redistribute( rowDist, colDist );
The constructor with distributions is more convenient and might be more efficient due to less memory allocations as less temporary data is needed.
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const DenseMatrix< ValueType > & | matrix, |
DistributionPtr | distribution, | ||
DistributionPtr | colDistribution | ||
) |
References lama::DenseMatrix< T >::computeOwners(), lama::Matrix::getColDistribution(), lama::Distribution::getCommunicator(), lama::Distributed::getDistribution(), lama::Distribution::getLocalSize(), lama::Matrix::getNumColumns(), lama::Distribution::getNumPartitions(), LAMA_THROWEXCEPTION, lama::DenseMatrix< T >::localize(), lama::DenseMatrix< T >::mData, lama::DenseMatrix< T >::mOwners, and lama::DenseMatrix< T >::splitColumnData().
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const _MatrixStorage & | localData, |
DistributionPtr | rowDist, | ||
DistributionPtr | colDist | ||
) |
Constructor of a dense 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 columns of local rows |
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::DenseMatrix< ValueType >::DenseMatrix | ( | const IndexType | numRows, |
const IndexType | numColumns, | ||
const IndexType | numNoneZeros, | ||
const IndexType *const | ia, | ||
const IndexType *const | ja, | ||
const OtherValueType *const | values | ||
) |
Creates a replicated dense matrix from the passed csr sparse matrix.
[in] | numRows | the number of rows of the matrix |
[in] | numColumns | the number of columns of the matrix |
[in] | numNoneZeros | the number of none zeros of the matrix |
[in] | ia | row pointer of the input csr sparse matrix |
[in] | ja | column indexes of the input csr sparse matrix |
[in] | values | the none zero values of the input csr sparse matrix |
References lama::DenseMatrix< T >::computeOwners(), lama::DenseMatrix< T >::mData, lama::Matrix::mNumColumns, and lama::Matrix::mNumRows.
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const Expression< Expression< Scalar, Expression< Matrix, Matrix, Times >, Times >, Expression< Scalar, Matrix, Times >, Plus > | expression | ) |
References lama::Matrix::operator=().
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const Expression< Matrix, Matrix, Times > | expression | ) |
References lama::Matrix::operator=().
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const Expression< Scalar, Expression< Matrix, Matrix, Times >, Times > | expression | ) |
References lama::Matrix::operator=().
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const Expression< Scalar, Matrix, Times > | expression | ) |
References lama::Matrix::operator=().
lama::DenseMatrix< ValueType >::DenseMatrix | ( | const std::string & | filename | ) |
Constructor of a replicated dense 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.
References lama::Matrix::setReplicatedMatrix().
lama::DenseMatrix< ValueType >::~DenseMatrix | ( | ) | [virtual] |
void lama::DenseMatrix< ValueType >::allocate | ( | const IndexType | numRows, |
const IndexType | numColumns | ||
) | [virtual] |
Reallocate this matrix to a replicated zero-matrix of the given shape.
Implements lama::Matrix.
References LAMA_ASSERT_ERROR, and lama::Matrix::setReplicatedMatrix().
Referenced by lama::SparseMatrix< T >::matrixTimesVectorNImpl().
void lama::DenseMatrix< ValueType >::allocate | ( | DistributionPtr | rowDistribution, |
DistributionPtr | colDistribution | ||
) | [virtual] |
Reallocate this matrix to a distributed zero-matrix by the given distributions.
Implements lama::Matrix.
References LAMA_THROWEXCEPTION, and lama::Matrix::setDistributedMatrix().
void lama::DenseMatrix< ValueType >::allocateData | ( | ) | [private] |
Allocate of storage for the column blocks.
References LAMA_ASSERT_DEBUG, and LAMA_ASSERT_EQUAL_DEBUG.
Referenced by lama::DenseMatrix< T >::DenseMatrix().
void lama::DenseMatrix< ValueType >::assign | ( | const Matrix & | other | ) | [virtual] |
This method assigns a matrix to this matrix with automatic conversion to the needed matrix type and the current row / column distribution of.
[in] | other | must be matrix with same global sizes |
Implements lama::Matrix.
References lama::Matrix::DENSE, lama::Scalar::DOUBLE, lama::Scalar::FLOAT, lama::Matrix::getColDistributionPtr(), lama::Distributed::getDistributionPtr(), lama::Matrix::getMatrixKind(), lama::Matrix::getValueType(), LAMA_THROWEXCEPTION, and lama::Matrix::setDistributedMatrix().
Referenced by lama::DenseMatrix< T >::DenseMatrix().
void lama::DenseMatrix< ValueType >::assign | ( | const _MatrixStorage & | storage | ) | [virtual] |
Assign replicated storage for a replicated matrix.
Implements lama::Matrix.
References lama::_MatrixStorage::getNumColumns(), lama::_MatrixStorage::getNumRows(), and lama::Matrix::setReplicatedMatrix().
void lama::DenseMatrix< ValueType >::assign | ( | const _MatrixStorage & | storage, |
DistributionPtr | rowDist, | ||
DistributionPtr | colDist | ||
) | [virtual] |
Assign local storage for a distributed matrix.
Implements lama::Matrix.
References lama::DenseStorageView< T >::assign(), lama::DENSE, lama::_MatrixStorage::getFormat(), lama::_MatrixStorage::getNumRows(), lama::_MatrixStorage::getValueType(), LAMA_ASSERT_ERROR, LAMA_THROWEXCEPTION, lama::MatrixStorage< T >::localize(), and lama::Matrix::setDistributedMatrix().
void lama::DenseMatrix< ValueType >::assignLocal | ( | const _MatrixStorage & | other | ) |
References lama::_MatrixStorage::buildCSRData().
void lama::DenseMatrix< ValueType >::assignSparse | ( | const _SparseMatrix & | other | ) |
void lama::DenseMatrix< ValueType >::buildCSRData | ( | LAMAArray< IndexType > & | rowIA, |
LAMAArray< IndexType > & | rowJA, | ||
_LAMAArray & | rowValues | ||
) | const [virtual] |
Implementation of pure method for the dense storage format.
References lama::_LAMAArray::getValueType(), and LAMA_THROWEXCEPTION.
void lama::DenseMatrix< ValueType >::buildLocalStorage | ( | _MatrixStorage & | storage | ) | const [virtual] |
Implementation of Matrix::buildLocalStorage.
Implements lama::Matrix.
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::DenseMatrix< ValueType >::clear | ( | ) | [virtual] |
Implementation of pure method.
Implements lama::Matrix.
References lama::Matrix::setReplicatedMatrix().
void lama::DenseMatrix< ValueType >::computeOwners | ( | ) | [private] |
References lama::Distribution::computeOwners().
Referenced by lama::DenseMatrix< T >::DenseMatrix().
std::auto_ptr< Matrix > lama::DenseMatrix< ValueType >::copy | ( | ) | const [virtual] |
Constructing a new object by the copy constructor.
Implements lama::Matrix.
void lama::DenseMatrix< T >::copyDenseMatrix | ( | const DenseMatrix< otherT > & | other | ) | [private] |
Copy a dense matrix with different data type; inherits sizes and distributions.
void lama::DenseMatrix< T >::copyDenseMatrix | ( | const DenseMatrix< OtherValueType > & | other | ) |
std::auto_ptr< Matrix > lama::DenseMatrix< ValueType >::create | ( | ) | const [virtual] |
Constructing a new object by the default constructor.
Implements lama::Matrix.
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 >.
virtual ContextPtr lama::DenseMatrix< T >::getContextPtr | ( | ) | const [inline, virtual] |
Getter routine for the context.
Note: Only for SparseMatrix the context of the halo can be queried.
Implements lama::Matrix.
Referenced by lama::DenseMatrixOps::invertCyclic().
std::vector< typename DenseMatrix< ValueType >::DenseStoragePtr > & lama::DenseMatrix< ValueType >::getCyclicLocalValues | ( | ) |
Referenced by lama::LUSolver::computeLUFactorization(), and lama::LUSolver::ptrsm().
const std::vector< typename DenseMatrix< ValueType >::DenseStoragePtr > & lama::DenseMatrix< ValueType >::getCyclicLocalValues | ( | ) | const |
void lama::DenseMatrix< ValueType >::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::Vector::assign(), lama::Scalar::DOUBLE, lama::Scalar::FLOAT, lama::Vector::getValueType(), and LAMA_THROWEXCEPTION.
void lama::DenseMatrix< T >::getDiagonalImpl | ( | DenseVector< OtherT > & | diagonal | ) | const [private] |
Optimized implementation for dense vectors as diagonal.
void lama::DenseMatrix< T >::getDiagonalImpl | ( | DenseVector< OtherValueType > & | diagonal | ) | const |
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::DenseMatrix< ValueType >::getLocalNumColumns | ( | ) | const [virtual] |
Getter routine for the local number of rows and columns.
Implements lama::Matrix.
IndexType lama::DenseMatrix< ValueType >::getLocalNumRows | ( | ) | const [virtual] |
Getter routine for the local number of rows.
Implements lama::Matrix.
IndexType lama::DenseMatrix< ValueType >::getLocalNumValues | ( | ) | const [virtual] |
Implementation of Matrix::getLocalNumValues, getLocalNumRows, getLocalNumColumns.
Implements lama::Matrix.
const DenseStorage< ValueType > & lama::DenseMatrix< ValueType >::getLocalStorage | ( | ) | const |
This method returns the storage containing the local data regarding row/col distribution.
References LAMA_ASSERT_EQUAL_ERROR, and LAMA_ASSERT_ERROR.
Referenced by lama::InverseSolver::decompose(), lama::InverseSolver::invert(), lama::DenseMatrixOps::invertCyclic(), lama::DenseMatrixOps::invertReplicated(), and lama::SparseMatrix< T >::matrixTimesVectorNImpl().
DenseStorage< ValueType > & lama::DenseMatrix< ValueType >::getLocalStorage | ( | ) |
References LAMA_ASSERT_EQUAL_ERROR, and LAMA_ASSERT_ERROR.
Matrix::MatrixKind lama::DenseMatrix< T >::getMatrixKind | ( | ) | const [inline, virtual] |
Each derived matrix must give info about its kind (DENSE or SPARSE).
Implements lama::Matrix.
References lama::DENSE.
size_t lama::DenseMatrix< ValueType >::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.
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::DenseMatrix< ValueType >::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.
const std::vector<PartitionId>& lama::DenseMatrix< T >::getOwners | ( | ) | const [inline] |
Referenced by lama::DenseMatrix< T >::copyDenseMatrix().
void lama::DenseMatrix< ValueType >::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::Vector::getValueType(), LAMA_ASSERT_DEBUG, and LAMA_THROWEXCEPTION.
void lama::DenseMatrix< ValueType >::getRow | ( | DenseVector< ValueType > & | row, |
const IndexType | i | ||
) | const [private] |
double lama::Matrix::getSparsityRate | ( | ) | const [inherited] |
References lama::Matrix::getNumValues(), lama::Matrix::mNumColumns, and lama::Matrix::mNumRows.
const char * lama::DenseMatrix< ValueType >::getTypeName | ( | ) | const [virtual] |
Implementation for Matrix::getTypeName()
Implements lama::Matrix.
Scalar lama::DenseMatrix< ValueType >::getValue | ( | lama::IndexType | i, |
lama::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::Distribution::getCommunicator(), lama::Distribution::getNumPartitions(), lama::Communicator::getRank(), lama::Distribution::global2local(), lama::Distribution::isLocal(), LAMA_ASSERT_ERROR, lama::nIndex, and lama::Communicator::sum().
Scalar::ScalarType lama::DenseMatrix< ValueType >::getValueType | ( | ) | const [virtual] |
bool lama::DenseMatrix< ValueType >::hasDiagonalProperty | ( | ) | const [virtual] |
hasDiagonalProperty returns the diagonalProperty of the local storage.
Implements lama::Matrix.
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::DenseMatrix< ValueType >::invert | ( | const Matrix & | other | ) | [virtual] |
Set this matrix with the inverse of another square matrix.
This matrix will have afterwards the same distribution as the other matrix.
Implements lama::Matrix.
References lama::Matrix::getColDistributionPtr(), lama::Distribution::getCommunicatorPtr(), lama::Distributed::getDistributionPtr(), lama::Matrix::getNumColumns(), lama::Matrix::getNumRows(), and LAMA_ASSERT_ERROR.
Referenced by lama::SparseMatrix< T >::invert().
void lama::DenseMatrix< T >::invert | ( | ) | [inline] |
Invert in place.
References lama::DenseMatrix< T >::invert().
Referenced by lama::DenseMatrix< T >::invert().
void lama::DenseMatrix< ValueType >::invertCyclic | ( | ) | [private] |
Special implementation of invert in place for a cyclic distributed matrix.
References lama::CyclicDistribution::chunkSize(), lama::WriteAccess< T >::get(), lama::DenseStorageView< T >::getData(), lama::_MatrixStorage::getNumRows(), lama::LAMAInterface::getSCALAPACKInterface(), LAMA_ASSERT_EQUAL_ERROR, LAMA_ASSERT_ERROR, LAMA_REGION, LAMA_THROWEXCEPTION, and lama::_LAMAArray::size().
void lama::DenseMatrix< ValueType >::joinColumnData | ( | DenseStorage< ValueType > & | result, |
const std::vector< boost::shared_ptr< DenseStorage< ValueType > > > & | chunks, | ||
const std::vector< IndexType > & | columnOwners | ||
) | [static, private] |
Join dense storage of column distributed data.
[out] | result | will be the joined storage |
[in] | chunks | is a vector of all chunks, one chunk for each partition |
[in] | columnOnwers | vector with owner for each column |
Note: the column distribution itself is given implicitly by the vector of owners
References lama::DenseStorageView< T >::getData(), lama::_MatrixStorage::getNumColumns(), lama::_MatrixStorage::getNumRows(), LAMA_ASSERT_EQUAL_ERROR, and LAMA_ASSERT_ERROR.
lama::DenseMatrix< T >::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [private] |
Reimplemented from lama::Matrix.
void lama::DenseMatrix< ValueType >::localize | ( | DenseStorage< ValueType > & | local, |
const DenseStorage< ValueType > & | global, | ||
const Distribution & | rowDistribution | ||
) | [static, private] |
Restrict dense storage of a replicated matrix to its local part according to row distribution.
[out] | local | is the local part of the dense storage for this partition |
[in] | global | is the replicated dense storage |
[in] | rowDistribution | distribution used to localize the dense storage. |
References lama::DenseStorageView< T >::allocate(), lama::DenseStorageView< T >::getData(), lama::Distribution::getGlobalSize(), lama::Distribution::getLocalSize(), lama::_MatrixStorage::getNumColumns(), lama::_MatrixStorage::getNumRows(), LAMA_ASSERT_EQUAL_ERROR, and lama::Distribution::local2global().
Referenced by lama::DenseMatrix< T >::DenseMatrix().
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::DenseMatrix< ValueType >::matrixTimesMatrix | ( | Matrix & | result, |
const Scalar | alpha, | ||
const Matrix & | x, | ||
const Scalar | beta, | ||
const Matrix & | y | ||
) | const [virtual] |
Implementation of pure method Matrix::matrixTimesMatrix.
Implements lama::Matrix.
References lama::Matrix::getColDistribution(), lama::Matrix::getColDistributionPtr(), lama::Distributed::getDistribution(), lama::Scalar::getValue(), lama::Distribution::isReplicated(), LAMA_ASSERT_ERROR, LAMA_THROWEXCEPTION, lama::DenseMatrix< T >::mData, and lama::DenseMatrix< T >::prefetch().
void lama::DenseMatrix< ValueType >::matrixTimesScalar | ( | const Matrix & | other, |
const Scalar | alpha | ||
) | [virtual] |
matrixTimesScalar computes this = alpha * other
matrixTimesScalar computes this = alpha * other.
Implements lama::Matrix.
References lama::Scalar::getValue().
void lama::CRTPMatrix< DenseMatrix< T > , T >::matrixTimesVector | ( | Vector & | result, |
const Scalar | alpha, | ||
const Vector & | x, | ||
const Scalar | beta, | ||
const Vector & | y | ||
) | const [inline, 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.
References lama::Matrix::getColDistribution(), lama::Distributed::getDistribution(), lama::Distributed::getDistributionPtr(), lama::Scalar::getValue(), LAMA_ASSERT, LAMA_ASSERT_EQUAL, LAMA_REGION, LAMA_THROWEXCEPTION, and lama::Vector::resize().
void lama::DenseMatrix< ValueType >::matrixTimesVectorImpl | ( | DenseVector< ValueType > & | denseResult, |
const ValueType | alphaValue, | ||
const DenseVector< ValueType > & | denseX, | ||
const ValueType | betaValue, | ||
const DenseVector< ValueType > & | denseY | ||
) | const |
Matrix times vector with same values types and correct distributions.
Note: Matrix::matrixTimesMatrix is implemented in the CRTPMatrix class. that requires this method.
Note: all vectors must have the right distribution.
References lama::Matrix::ASYNCHRONOUS, lama::Matrix::getCommunicationKind(), lama::Distribution::getCommunicator(), lama::DenseVector< T >::getLocalValues(), lama::Communicator::getNeighbor(), lama::Distribution::getNumPartitions(), lama::Communicator::getRank(), LAMA_REGION, lama::DenseStorageView< T >::matrixTimesVector(), lama::Communicator::max(), lama::DenseVector< T >::prefetch(), lama::WriteAccess< T >::resize(), lama::Communicator::shift(), lama::Communicator::shiftAsync(), lama::_LAMAArray::size(), lama::SyncToken::wait(), and lama::zero.
Scalar lama::DenseMatrix< ValueType >::maxDiffNorm | ( | const Matrix & | other | ) | const [virtual] |
Implementation of Matrix::maxDiffNorm for dense matrices.
Implements lama::Matrix.
References lama::Matrix::getColDistribution(), lama::Distributed::getDistribution(), lama::Matrix::getValueType(), LAMA_ASSERT_DEBUG, and LAMA_UNSUPPORTED.
ValueType lama::DenseMatrix< ValueType >::maxDiffNormImpl | ( | const DenseMatrix< ValueType > & | other | ) | const |
Get the maximal difference between two elements for dense matrices of same type.
References lama::Matrix::getColDistribution(), lama::Distributed::getDistribution(), LAMA_ASSERT_EQUAL_ERROR, lama::Communicator::max(), and lama::DenseMatrix< T >::mData.
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().
DenseMatrix< ValueType > & lama::DenseMatrix< ValueType >::operator= | ( | const DenseMatrix< T > & | matrix | ) |
Override default assignment operator needed to guarantee deep copy.
DenseMatrix< ValueType > & lama::DenseMatrix< ValueType >::operator= | ( | const Matrix & | other | ) |
the assignment operator for matrix.
[in] | other | is the input matrix. |
The assignment operator will make a deep copy of the input matrix. Size and distributions are inherited, but there might be implicit conversions regarding storage format and/or value type of the matrix elements.
Reimplemented from lama::Matrix.
DenseMatrix< ValueType > & lama::DenseMatrix< ValueType >::operator= | ( | const Expression< Scalar, Matrix, Times > | exp | ) |
the assignment operator for a scalar matrix multiplication.
Reimplemented from lama::Matrix.
References lama::Matrix::operator=().
DenseMatrix< ValueType > & lama::DenseMatrix< ValueType >::operator= | ( | const Expression< Matrix, Matrix, Times > | exp | ) |
the assignment operator for a matrix matrix multiplication.
Reimplemented from lama::Matrix.
References lama::Matrix::operator=().
DenseMatrix< ValueType > & lama::DenseMatrix< ValueType >::operator= | ( | const Expression< Scalar, Expression< Matrix, Matrix, Times >, Times > | exp | ) |
the assignment operator for a scalar matrix matrix multiplication.
the assignment operator for a matrix matrix multiplication.
Reimplemented from lama::Matrix.
References lama::Matrix::operator=().
DenseMatrix< ValueType > & lama::DenseMatrix< ValueType >::operator= | ( | const Expression< Expression< Scalar, Expression< Matrix, Matrix, Times >, Times >, Expression< Scalar, Matrix, Times >, Plus > | exp | ) |
the assignment operator for a GEMM expression.
Reimplemented from lama::Matrix.
References lama::Matrix::operator=().
void lama::DenseMatrix< ValueType >::prefetch | ( | ) | const [virtual] |
Prefetch matrix data to its 'preferred' context location.
Implements lama::Matrix.
Referenced by lama::DenseMatrix< T >::matrixTimesMatrix().
void lama::DenseMatrix< ValueType >::prefetch | ( | lama::ContextPtr | loc | ) | const |
void lama::DenseMatrix< ValueType >::redistribute | ( | DistributionPtr | rowDistribution, |
DistributionPtr | colDistribution | ||
) | [virtual] |
Implementation of pure method.
Implements lama::Matrix.
References LAMA_REGION, and lama::Matrix::mColDistribution.
Referenced by lama::DenseMatrixOps::invert().
void lama::DenseMatrix< ValueType >::redistributeRows | ( | DistributionPtr | rowDistribution | ) | [private] |
void lama::DenseMatrix< ValueType >::resetDiagonalProperty | ( | ) | [virtual] |
resetDiagonalProperty rechecks the storages for their diagonal property
Implements lama::Matrix.
void lama::DenseMatrix< ValueType >::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::Scalar::DOUBLE, lama::Scalar::FLOAT, lama::DenseVector< T >::getLocalValues(), and LAMA_THROWEXCEPTION.
void lama::DenseMatrix< ValueType >::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_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::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::DenseMatrix< ValueType >::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.
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::DenseMatrix< ValueType >::setCSRData | ( | const LAMAArray< IndexType > & | rowIA, |
const LAMAArray< IndexType > & | rowJA, | ||
const _LAMAArray & | rowValues, | ||
DistributionPtr | rowDistribution, | ||
DistributionPtr | colDistribution | ||
) | [virtual] |
Implementation of pure method.
void lama::DenseMatrix< ValueType >::setCSRDataLocal | ( | const LAMAArray< IndexType > & | rowIA, |
const LAMAArray< IndexType > & | rowJA, | ||
const _LAMAArray & | rowValues | ||
) | const |
Local version of setCSRData .
References lama::_LAMAArray::size().
void lama::DenseMatrix< ValueType >::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::Scalar::DOUBLE, lama::Scalar::FLOAT, lama::DenseVector< T >::getLocalValues(), and LAMA_THROWEXCEPTION.
void lama::DenseMatrix< ValueType >::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_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::DenseMatrix< ValueType >::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::Communicator::getRank(), lama::Communicator::getSize(), LAMA_ASSERT_EQUAL_DEBUG, and LAMA_THROWEXCEPTION.
void lama::DenseMatrix< ValueType >::setRawDenseData | ( | const IndexType | numRows, |
const IndexType | numColumns, | ||
const OtherValueType | values[], | ||
const OtherValueType | eps = 0.0 |
||
) |
Set 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::DenseMatrix< ValueType >::splitColumnData | ( | std::vector< boost::shared_ptr< DenseStorage< ValueType > > > & | chunks, |
const DenseStorage< ValueType > & | columnData, | ||
const PartitionId | numChunks, | ||
const std::vector< IndexType > & | columnOwners | ||
) | [static, private] |
Split dense storage data according to a distribution into chunks.
[out] | chunks | vector of shared pointer to the new allocated chunks |
[in] | columnData | is the dense storage to split |
[in] | numChunks | is the number of chunks, same as #partitions of distribution |
[in] | columnOnwers | owner for each column |
References lama::DenseStorageView< T >::getData(), lama::_MatrixStorage::getNumColumns(), lama::_MatrixStorage::getNumRows(), LAMA_ASSERT_DEBUG, and LAMA_ASSERT_EQUAL_ERROR.
Referenced by lama::DenseMatrix< T >::DenseMatrix().
void lama::DenseMatrix< ValueType >::splitColumns | ( | DistributionPtr | colDistribution | ) | [private] |
Split the replicated columns into chunks according to the column distribution.
References LAMA_ASSERT_EQUAL_ERROR, and lama::Matrix::setDistributedMatrix().
void lama::Distributed::swap | ( | Distributed & | other | ) | [protected, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::Matrix::swapMatrix().
void lama::DenseMatrix< ValueType >::swap | ( | DenseMatrix< ValueType > & | other | ) |
Swap will swap all member variables of the two dense matrices.
This operation might be useful in iteration loops where a dense matrix is updated each iteration. It is more convenient than a solution that is based on using pointers in the application.
References lama::DenseMatrix< T >::mData, lama::DenseMatrix< T >::mOwners, and 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().
static const char* lama::DenseMatrix< T >::typeName | ( | ) | [static] |
Getter for the type name of the class.
const char * lama::DenseMatrix< float >::typeName | ( | ) |
const char * lama::DenseMatrix< double >::typeName | ( | ) |
void lama::DenseMatrix< ValueType >::wait | ( | ) | const [virtual] |
wait for a possibly running prefetch.
Implements lama::Matrix.
void lama::DenseMatrix< ValueType >::writeAt | ( | std::ostream & | stream | ) | const [virtual] |
Write some information about this to the passed stream.
[out] | stream | the stream to write to. |
Reimplemented from lama::Matrix.
void lama::DenseMatrix< 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 |
Method writes dense matrix to a file.
Writing is only supported for a replicated matrix.
References lama::Communicator::getRank(), LAMA_THROWEXCEPTION, and lama::Communicator::synchronize().
DistributionPtr lama::Matrix::mColDistribution [protected, inherited] |
std::vector<boost::shared_ptr<DenseStorage<ValueType> > > lama::DenseMatrix< T >::mData |
local data is allocated in chunks according to column distribution
Referenced by lama::DenseMatrix< T >::copyDenseMatrix(), lama::DenseMatrix< T >::DenseMatrix(), lama::DenseMatrix< T >::matrixTimesMatrix(), lama::DenseMatrix< T >::maxDiffNormImpl(), and lama::DenseMatrix< T >::swap().
IndexType lama::Matrix::mNumColumns [protected, inherited] |
IndexType lama::Matrix::mNumRows [protected, inherited] |
std::vector<PartitionId> lama::DenseMatrix< T >::mOwners [protected] |
Referenced by lama::DenseMatrix< T >::DenseMatrix(), and lama::DenseMatrix< T >::swap().
LAMAArray<ValueType> lama::DenseMatrix< T >::mReceiveValues [mutable, private] |
LAMAArray<ValueType> lama::DenseMatrix< T >::mSendValues [mutable, private] |