Tpetra::CrsMatrix< Ordinal, Scalar > Class Template Reference

Tpetra::CrsMatrix: A class for constructing and using sparse compressed index matrices and row access. More...

#include <Tpetra_CrsMatrix.hpp>

Inheritance diagram for Tpetra::CrsMatrix< Ordinal, Scalar >:

Tpetra::Operator< Ordinal, Scalar > Teuchos::Object List of all members.

Public Member Functions

Constructor/Destructor Methods
 CrsMatrix (const Map< Ordinal > &rowMap)
 Constructor specifying the domain map only.
Query Methods
bool isFillCompleted () const
 Returns true if the matrix has already been fill completed.
Teuchos::RCP< const Teuchos::Comm<
Ordinal > > 
getComm () const
 Returns the communicator.
Ordinal getNumGlobalNonzeros () const
 Returns the number of nonzero entries in the global matrix.
Ordinal getNumMyNonzeros () const
 Returns the number of nonzero entries in the calling image's portion of the matrix.
Ordinal getNumGlobalRows () const
 Returns the number of global matrix rows.
Ordinal getNumGlobalCols () const
 Returns the number of global matrix columns.
Ordinal getNumMyRows () const
 Returns the number of matrix rows owned by the calling image.
Ordinal getNumMyCols () const
 Returns the number of matrix columns referenced by the calling image.
Ordinal getNumGlobalDiagonals () const
 Returns the number of global nonzero diagonal entries, based on global row/column index comparisons.
Ordinal getNumMyDiagonals () const
 Returns the number of local nonzero diagonal entries, based on global row/column index comparisons.
Ordinal getGlobalMaxNumEntries () const
 Returns the maximum number of nonzero entries across all rows/columns on all images.
Ordinal getMyMaxNumEntries () const
 Returns the maximum number of nonzero entries across all rows/columns on this image.
Ordinal getIndexBase () const
 Returns the index base for global indices for this matrix.
const Map< Ordinal > & getRowMap () const
 Returns the Map that describes the row distribution in this matrix.
const Map< Ordinal > & getColMap () const
 Returns the Map that describes the column distribution in this matrix.
Methods implementing Tpetra::Operator
const Map< Ordinal > & getDomainMap () const
 Returns the Map associated with the domain of this operator.
const Map< Ordinal > & getRangeMap () const
 Returns the Map associated with the domain of this operator.
void apply (const MultiVector< Ordinal, Scalar > &X, MultiVector< Ordinal, Scalar > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS) const
 Computes the matrix-vector multilication y = A x.
Construction Methods
void fillComplete ()
 Signals that data entry is complete. Matrix data is converted into a more optimized form.
void submitEntry (Ordinal globalRow, Ordinal globalCol, const Scalar &value)
 Submits one local or nonlocal entry to the matrix using global IDs.
void submitEntries (Ordinal globalRow, const Teuchos::ArrayView< const Ordinal > &cols, const Teuchos::ArrayView< const Scalar > &vals)
 Submit multiple entries, using global IDs.
void setAllToScalar (const Scalar &alpha)
 Set all matrix entries equal to scalarThis.
void scale (const Scalar &alpha)
 Scale the current values of a matrix, this = alpha*this.
Data Access Methods
Ordinal getNumRowEntries (Ordinal globalRow) const
 Returns the current number of nonzero entries in specified global index on this image.
void getMyRowCopy (Ordinal myRow, const Teuchos::ArrayView< Ordinal > &indices, const Teuchos::ArrayView< Scalar > &values) const
 Returns a copy of the specified local row, column indices are local.
void getGlobalRowCopy (Ordinal globalRow, const Teuchos::ArrayView< Ordinal > &indices, const Teuchos::ArrayView< Scalar > &values) const
 Returns a copy of the specified (and locally owned) global row, column indices are global.
I/O Methods
void print (std::ostream &os) const
 Prints the matrix on the specified stream. This is very verbose.

Detailed Description

template<class Ordinal, class Scalar>
class Tpetra::CrsMatrix< Ordinal, Scalar >

Tpetra::CrsMatrix: A class for constructing and using sparse compressed index matrices and row access.

This class allows the construction of sparse matrices with row-access. Methods submitEntry() and submitEntries() can be used to set both locally owned and non-local elements; the shipping of data is done with hardcoded MPI calls when fillComplete() is called.

The nonzero elements of locally owned row can be accessed by method getMyRowCopy() or getGlobalRowCopy(). The former returns the column indices using local numbering, the latter using global numbering.


Constructor & Destructor Documentation

template<class Ordinal, class Scalar>
Tpetra::CrsMatrix< Ordinal, Scalar >::CrsMatrix ( const Map< Ordinal > &  rowMap  ) 

Constructor specifying the domain map only.


Member Function Documentation

template<class Ordinal, class Scalar>
bool Tpetra::CrsMatrix< Ordinal, Scalar >::isFillCompleted (  )  const [inline]

Returns true if the matrix has already been fill completed.

template<class Ordinal, class Scalar>
Teuchos::RCP< const Teuchos::Comm< Ordinal > > Tpetra::CrsMatrix< Ordinal, Scalar >::getComm (  )  const

Returns the communicator.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumGlobalNonzeros (  )  const [inline]

Returns the number of nonzero entries in the global matrix.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumMyNonzeros (  )  const [inline]

Returns the number of nonzero entries in the calling image's portion of the matrix.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumGlobalRows (  )  const [inline]

Returns the number of global matrix rows.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumGlobalCols (  )  const [inline]

Returns the number of global matrix columns.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumMyRows (  )  const [inline]

Returns the number of matrix rows owned by the calling image.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumMyCols (  )  const [inline]

Returns the number of matrix columns referenced by the calling image.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumGlobalDiagonals (  )  const [inline]

Returns the number of global nonzero diagonal entries, based on global row/column index comparisons.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumMyDiagonals (  )  const [inline]

Returns the number of local nonzero diagonal entries, based on global row/column index comparisons.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getGlobalMaxNumEntries (  )  const [inline]

Returns the maximum number of nonzero entries across all rows/columns on all images.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getMyMaxNumEntries (  )  const [inline]

Returns the maximum number of nonzero entries across all rows/columns on this image.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getIndexBase (  )  const [inline]

Returns the index base for global indices for this matrix.

template<class Ordinal, class Scalar>
const Map< Ordinal > & Tpetra::CrsMatrix< Ordinal, Scalar >::getRowMap (  )  const

Returns the Map that describes the row distribution in this matrix.

template<class Ordinal, class Scalar>
const Map< Ordinal > & Tpetra::CrsMatrix< Ordinal, Scalar >::getColMap (  )  const

Returns the Map that describes the column distribution in this matrix.

template<class Ordinal, class Scalar>
const Map< Ordinal > & Tpetra::CrsMatrix< Ordinal, Scalar >::getDomainMap (  )  const [virtual]

Returns the Map associated with the domain of this operator.

Implements Tpetra::Operator< Ordinal, Scalar >.

template<class Ordinal, class Scalar>
const Map< Ordinal > & Tpetra::CrsMatrix< Ordinal, Scalar >::getRangeMap (  )  const [virtual]

Returns the Map associated with the domain of this operator.

Implements Tpetra::Operator< Ordinal, Scalar >.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::apply ( const MultiVector< Ordinal, Scalar > &  X,
MultiVector< Ordinal, Scalar > &  Y,
Teuchos::ETransp  mode = Teuchos::NO_TRANS 
) const [virtual]

Computes the matrix-vector multilication y = A x.

Implements Tpetra::Operator< Ordinal, Scalar >.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::fillComplete (  ) 

Signals that data entry is complete. Matrix data is converted into a more optimized form.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::submitEntry ( Ordinal  globalRow,
Ordinal  globalCol,
const Scalar &  value 
)

Submits one local or nonlocal entry to the matrix using global IDs.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::submitEntries ( Ordinal  globalRow,
const Teuchos::ArrayView< const Ordinal > &  cols,
const Teuchos::ArrayView< const Scalar > &  vals 
)

Submit multiple entries, using global IDs.

All index values must be in the global space. Behavoir is defined by the CombineMode passed in.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::setAllToScalar ( const Scalar &  alpha  ) 

Set all matrix entries equal to scalarThis.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::scale ( const Scalar &  alpha  ) 

Scale the current values of a matrix, this = alpha*this.

template<class Ordinal, class Scalar>
Ordinal Tpetra::CrsMatrix< Ordinal, Scalar >::getNumRowEntries ( Ordinal  globalRow  )  const [inline]

Returns the current number of nonzero entries in specified global index on this image.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::getMyRowCopy ( Ordinal  myRow,
const Teuchos::ArrayView< Ordinal > &  indices,
const Teuchos::ArrayView< Scalar > &  values 
) const

Returns a copy of the specified local row, column indices are local.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::getGlobalRowCopy ( Ordinal  globalRow,
const Teuchos::ArrayView< Ordinal > &  indices,
const Teuchos::ArrayView< Scalar > &  values 
) const

Returns a copy of the specified (and locally owned) global row, column indices are global.

template<class Ordinal, class Scalar>
void Tpetra::CrsMatrix< Ordinal, Scalar >::print ( std::ostream &  os  )  const [virtual]

Prints the matrix on the specified stream. This is very verbose.

Reimplemented from Teuchos::Object.


The documentation for this class was generated from the following file:
Generated on Wed May 12 21:59:41 2010 for Tpetra Matrix/Vector Services by  doxygen 1.4.7