INMOST
Mathematical Modelling Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
INMOST::Sparse::Matrix Class Reference

#include <inmost_sparse.h>

Collaboration diagram for INMOST::Sparse::Matrix:

Public Types

typedef interval
< INMOST_DATA_ENUM_TYPE, Row
Rows
 
typedef Rows::iterator iterator
 
typedef Rows::const_iterator const_iterator
 

Public Member Functions

 Matrix (std::string _name="", INMOST_DATA_ENUM_TYPE start=0, INMOST_DATA_ENUM_TYPE end=0, INMOST_MPI_Comm _comm=INMOST_MPI_COMM_WORLD)
 
 Matrix (const Matrix &other)
 
Matrixoperator= (Matrix const &other)
 
 ~Matrix ()
 
Rowoperator[] (INMOST_DATA_ENUM_TYPE i)
 Return reference to i-th Row of the matrix. More...
 
const Rowoperator[] (INMOST_DATA_ENUM_TYPE i) const
 Return reference to i-th Row of the matrix. More...
 
INMOST_DATA_ENUM_TYPE Size () const
 Return the total number of rows in the matrix. More...
 
bool Empty () const
 
iterator Begin ()
 
iterator End ()
 
const_iterator Begin () const
 
const_iterator End () const
 
void SetInterval (INMOST_DATA_ENUM_TYPE start, INMOST_DATA_ENUM_TYPE end)
 Set the start and the end row numbers of the distributed matrix interval. More...
 
void GetInterval (INMOST_DATA_ENUM_TYPE &start, INMOST_DATA_ENUM_TYPE &end) const
 Get the start and the end row numbers of the distributed matrix interval. More...
 
void ShiftInterval (INMOST_DATA_ENUM_TYPE shift)
 
INMOST_DATA_ENUM_TYPE GetFirstIndex () const
 Get the first row index of the distributed matrix interval. More...
 
INMOST_MPI_Comm GetCommunicator () const
 Get the communicator which the matrix is associated with. More...
 
void MoveRows (INMOST_DATA_ENUM_TYPE from, INMOST_DATA_ENUM_TYPE to, INMOST_DATA_ENUM_TYPE size)
 
void Swap (Matrix &other)
 
void MatVec (INMOST_DATA_REAL_TYPE alpha, Vector &x, INMOST_DATA_REAL_TYPE beta, Vector &y) const
 
void MatVecTranspose (INMOST_DATA_REAL_TYPE alpha, Vector &x, INMOST_DATA_REAL_TYPE beta, Vector &y) const
 
void Clear ()
 Clear all data of the matrix. More...
 
void Load (std::string file, INMOST_DATA_ENUM_TYPE beg=ENUMUNDEF, INMOST_DATA_ENUM_TYPE end=ENUMUNDEF)
 
void Save (std::string file)
 
boolisParallel ()
 Check that matrix is in parallel state. More...
 
std::string GetName ()
 Get the matrix name specified in the main constructor. More...
 

Detailed Description

Class to store the distributed sparse matrix by compressed rows. The format used to store sparse matrix is analogous to Compressed Row Storage format (CRS).

See Also
http://netlib.org/linalg/html_templates/node91.html

Definition at line 244 of file inmost_sparse.h.

Member Typedef Documentation

Definition at line 249 of file inmost_sparse.h.

Definition at line 248 of file inmost_sparse.h.

Definition at line 247 of file inmost_sparse.h.

Constructor & Destructor Documentation

INMOST::Sparse::Matrix::Matrix ( std::string  _name = "",
INMOST_DATA_ENUM_TYPE  start = 0,
INMOST_DATA_ENUM_TYPE  end = 0,
INMOST_MPI_Comm  _comm = INMOST_MPI_COMM_WORLD 
)

Main constructor of the Matrix class.

Parameters
_nameName of the matrix, empty string by default.
startStart of the local data interval.
endEnd of the local data interval.
_commCommunicator for parallel data exchanges, MPI_COMM_WORLD by default.
INMOST::Sparse::Matrix::Matrix ( const Matrix other)
INMOST::Sparse::Matrix::~Matrix ( )

Member Function Documentation

iterator INMOST::Sparse::Matrix::Begin ( )
inline

Definition at line 272 of file inmost_sparse.h.

Here is the call graph for this function:

Here is the caller graph for this function:

const_iterator INMOST::Sparse::Matrix::Begin ( ) const
inline

Definition at line 274 of file inmost_sparse.h.

Here is the call graph for this function:

void INMOST::Sparse::Matrix::Clear ( )
inline

Clear all data of the matrix.

Definition at line 304 of file inmost_sparse.h.

Here is the call graph for this function:

bool INMOST::Sparse::Matrix::Empty ( ) const
inline

Definition at line 271 of file inmost_sparse.h.

Here is the call graph for this function:

iterator INMOST::Sparse::Matrix::End ( )
inline

Definition at line 273 of file inmost_sparse.h.

Here is the call graph for this function:

Here is the caller graph for this function:

const_iterator INMOST::Sparse::Matrix::End ( ) const
inline

Definition at line 275 of file inmost_sparse.h.

Here is the call graph for this function:

INMOST_MPI_Comm INMOST::Sparse::Matrix::GetCommunicator ( ) const
inline

Get the communicator which the matrix is associated with.

Definition at line 284 of file inmost_sparse.h.

INMOST_DATA_ENUM_TYPE INMOST::Sparse::Matrix::GetFirstIndex ( ) const
inline

Get the first row index of the distributed matrix interval.

Definition at line 282 of file inmost_sparse.h.

Here is the call graph for this function:

void INMOST::Sparse::Matrix::GetInterval ( INMOST_DATA_ENUM_TYPE start,
INMOST_DATA_ENUM_TYPE end 
) const
inline

Get the start and the end row numbers of the distributed matrix interval.

Definition at line 279 of file inmost_sparse.h.

Here is the call graph for this function:

std::string INMOST::Sparse::Matrix::GetName ( )
inline

Get the matrix name specified in the main constructor.

Definition at line 315 of file inmost_sparse.h.

bool& INMOST::Sparse::Matrix::isParallel ( )
inline

Check that matrix is in parallel state.

Definition at line 313 of file inmost_sparse.h.

void INMOST::Sparse::Matrix::Load ( std::string  file,
INMOST_DATA_ENUM_TYPE  beg = ENUMUNDEF,
INMOST_DATA_ENUM_TYPE  end = ENUMUNDEF 
)

Load the matrix from a single data file in MTX format using the specified interval. If interval is not specified, then it will be automatically constructed, with the about equal block size (the last block may has larger dimension).

void INMOST::Sparse::Matrix::MatVec ( INMOST_DATA_REAL_TYPE  alpha,
Vector x,
INMOST_DATA_REAL_TYPE  beta,
Vector y 
) const

Matrix-vector product of the form: y = alpha*A*x + beta * y.

Parameters
yInput/output vector.
void INMOST::Sparse::Matrix::MatVecTranspose ( INMOST_DATA_REAL_TYPE  alpha,
Vector x,
INMOST_DATA_REAL_TYPE  beta,
Vector y 
) const

Matrix-vector product with transposed matrix of the form: y = alpha*A^T*x + beta * y.

Parameters
yInput/output vector.
void INMOST::Sparse::Matrix::MoveRows ( INMOST_DATA_ENUM_TYPE  from,
INMOST_DATA_ENUM_TYPE  to,
INMOST_DATA_ENUM_TYPE  size 
)
Matrix& INMOST::Sparse::Matrix::operator= ( Matrix const &  other)
Row& INMOST::Sparse::Matrix::operator[] ( INMOST_DATA_ENUM_TYPE  i)
inline

Return reference to i-th Row of the matrix.

Definition at line 266 of file inmost_sparse.h.

const Row& INMOST::Sparse::Matrix::operator[] ( INMOST_DATA_ENUM_TYPE  i) const
inline

Return reference to i-th Row of the matrix.

Definition at line 268 of file inmost_sparse.h.

void INMOST::Sparse::Matrix::Save ( std::string  file)

Save the distributed matrix to a single data file in MTX format using parallel MPI I/O.

See Also
http://math.nist.gov/MatrixMarket/formats.html
void INMOST::Sparse::Matrix::SetInterval ( INMOST_DATA_ENUM_TYPE  start,
INMOST_DATA_ENUM_TYPE  end 
)
inline

Set the start and the end row numbers of the distributed matrix interval.

Definition at line 277 of file inmost_sparse.h.

Here is the call graph for this function:

void INMOST::Sparse::Matrix::ShiftInterval ( INMOST_DATA_ENUM_TYPE  shift)
inline

Definition at line 280 of file inmost_sparse.h.

Here is the call graph for this function:

INMOST_DATA_ENUM_TYPE INMOST::Sparse::Matrix::Size ( ) const
inline

Return the total number of rows in the matrix.

Definition at line 270 of file inmost_sparse.h.

Here is the call graph for this function:

void INMOST::Sparse::Matrix::Swap ( Matrix other)
inline

Definition at line 286 of file inmost_sparse.h.

Here is the call graph for this function:


The documentation for this class was generated from the following file: