Tpetra Matrix/Vector Services Version of the Day
Classes | Functions
Tpetra::Ext Namespace Reference

Namespace for external Tpetra functionality. More...

Classes

struct  TypeStackBottom
 Implementation of a Tpetra::Ext::TypeStack, supporting the last entry. More...
struct  TypeStack
 Implementation of a Tpetra::Ext::TypeStack, supporting the next to last entry. More...
struct  TypeStack< T, TypeStack< S, SS > >
 Generic implementation of a Tpetra::Ext::TypeStack. This is the model that should be programmed to. More...

Functions

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockDiagonals (const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &matrix, const Teuchos::ArrayView< const LocalOrdinal > &first_points, Teuchos::ArrayRCP< Scalar > &out_diags, Teuchos::ArrayRCP< LocalOrdinal > &out_offsets)
 Extracts the block diagonals from a RowMatrix into contiguous, host storage.
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockDiagonals (const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &matrix, const Tpetra::BlockMap< LocalOrdinal, GlobalOrdinal, Node > &block_map, Teuchos::ArrayRCP< Scalar > &out_diags, Teuchos::ArrayRCP< LocalOrdinal > &out_offsets)
 Extracts the block diagonals from a RowMatrix into contiguous, host storage using a BlockMap.
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void extractBlockRow (LocalOrdinal localBlockRow, const RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &matrix, const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &block_row_map, const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &block_col_map, ArrayRCP< ArrayRCP< Scalar > > &out_block_entries, ArrayRCP< LocalOrdinal > &out_block_indices)
 Extracts block elements from a RowMatrix into contiguous, host storage.

Detailed Description

Namespace for external Tpetra functionality.


Function Documentation

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void Tpetra::Ext::extractBlockDiagonals ( const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  matrix,
const Teuchos::ArrayView< const LocalOrdinal > &  first_points,
Teuchos::ArrayRCP< Scalar > &  out_diags,
Teuchos::ArrayRCP< LocalOrdinal > &  out_offsets 
)

Extracts the block diagonals from a RowMatrix into contiguous, host storage.

This method does not initiate any communication, and therefore can be called safely on a single node.

Parameters:
inmatrix - The sparse matrix source for the diagonals.
infirst_points - A list of ordinals, where first_points[b] indicates the first local element in the b-th block.
outout_diags - A reference-counted array, containing the block diagonals in contiguous storage.
outout_offsets - A reference-counted array, indicating the offset to reach each block in out_diags.
Precondition:
- first_points[0] == 0
- elements in first_points are non-decreasing
- matrix.isFillComplete() == true
Postcondition:
- out_offsets.size() == block_sizes.size()
- the non-trivial b-th block is stored contiguously (column-major) in out_diags( out_offsets[b], block_size_b ), where $block\_size\_b = ( first\_points\[b+1\] - first\_points\[b\] )^2 $.
Examples:
CrsMatrix_BlockExtraction.cpp.
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void Tpetra::Ext::extractBlockDiagonals ( const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  matrix,
const Tpetra::BlockMap< LocalOrdinal, GlobalOrdinal, Node > &  block_map,
Teuchos::ArrayRCP< Scalar > &  out_diags,
Teuchos::ArrayRCP< LocalOrdinal > &  out_offsets 
)

Extracts the block diagonals from a RowMatrix into contiguous, host storage using a BlockMap.

This method does not initiate any communication, and therefore can be called safely on a single node.

Parameters:
inmatrix - The sparse matrix source for the diagonals.
inblock_map - A BlockMap describing the blocks
outout_diags - A reference-counted array, containing the block diagonals in contiguous storage.
outout_offsets - A reference-counted array, indicating the offset to reach each block in out_diags.
Precondition:
- block_map.getPointMap().isCompatible( matrix.getRowMap() )
- matrix.isFillComplete() == true
Postcondition:
- out_offsets.size() == block_sizes.size()
- the non-trivial b-th block is stored contiguously (column-major) in out_diags( out_offsets[b], block_map.getLocalBlockSize(b) )

Calls extractBlockDiagonals().

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
void Tpetra::Ext::extractBlockRow ( LocalOrdinal  localBlockRow,
const RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  matrix,
const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &  block_row_map,
const BlockMap< LocalOrdinal, GlobalOrdinal, Node > &  block_col_map,
ArrayRCP< ArrayRCP< Scalar > > &  out_block_entries,
ArrayRCP< LocalOrdinal > &  out_block_indices 
)

Extracts block elements from a RowMatrix into contiguous, host storage.

This method does not initiate any communication, and therefore can be called safely on a single node.

Parameters:
inblock_row - The block row to be extracted
inblock_row_map - A BlockMap describing the row blocks
inblock_col_map - A BlockMap describing the column blocks
inmatrix - The sparse matrix source for the diagonals.
outblock_entries - The block entries
outblock_indices - The indices for the block entries
Precondition:
- block_row_map.getPointMap().isCompatible( matrix.getRowMap() )
- block_row_map.getPointMap().isCompatible( matrix.getRowMap() )
- block_col_map.getPointMap().isCompatible( matrix.getColMap() )
- block_col_map.getPointMap().isCompatible( matrix.getColMap() )
- matrix.isFillComplete() == true
Examples:
CrsMatrix_BlockExtraction.cpp.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines