Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Classes | Protected Member Functions | Protected Attributes
Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator > Class Template Reference

Default implementation of sparse matrix-vector multiply and solve routines, for host-based Kokkos Node types. More...

#include <Kokkos_DefaultSparseOps.hpp>

Inheritance diagram for Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >:
Inheritance graph
[legend]

List of all members.

Classes

struct  bind_ordinal
 Local sparse operations type for a different ordinal type. More...
struct  bind_scalar
 Local sparse operations type for a different scalar type. More...
struct  graph
 Typedef for local graph class. More...
struct  matrix
 Typedef for local matrix class. More...

Public Types

Typedefs and structs
typedef Scalar scalar_type
 The type of the individual entries of the sparse matrix.
typedef Ordinal ordinal_type
 The type of the (local) indices describing the structure of the sparse matrix.
typedef Node node_type
 The Kokkos Node type.
typedef DefaultHostSparseOps
< Scalar, Ordinal, Node,
Allocator > 
sparse_ops_type
 The type of this object, the sparse operator object.

Public Member Functions

Constructors/Destructor
 DefaultHostSparseOps (const RCP< Node > &node)
 Constructor accepting and retaining a node object.
 DefaultHostSparseOps (const RCP< Node > &node, Teuchos::ParameterList &params)
 Constructor accepting and retaining a node object, and taking parameters.
 ~DefaultHostSparseOps ()
 Destructor.
Implementation of Teuchos::Describable
std::string description () const
 One-line description of this instance.
void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Write a possibly more verbose description of this instance to out.
Teuchos::RCP
< Teuchos::SerialDenseMatrix
< int, scalar_type > > 
asDenseMatrix () const
 Convert to dense matrix and return.
Accessor routines.
RCP< Node > getNode () const
 The Kokkos Node with which this object was instantiated.
Computational methods
template<class DomainScalar , class RangeScalar >
void multiply (Teuchos::ETransp trans, RangeScalar alpha, const MultiVector< DomainScalar, Node > &X, MultiVector< RangeScalar, Node > &Y) const
 Y := alpha * Op(A) * X.
template<class DomainScalar , class RangeScalar >
void multiply (Teuchos::ETransp trans, RangeScalar alpha, const MultiVector< DomainScalar, Node > &X, RangeScalar beta, MultiVector< RangeScalar, Node > &Y) const
 Y := beta * Y + alpha * Op(A) * X.
template<class DomainScalar , class RangeScalar >
void solve (Teuchos::ETransp trans, const MultiVector< DomainScalar, Node > &Y, MultiVector< RangeScalar, Node > &X) const
 Solve Y = Op(A) X for X, where we assume A is triangular.

Protected Member Functions

 DefaultHostSparseOps (const DefaultHostSparseOps &source)
 Copy constructor (protected and unimplemented)

Protected Attributes

RCP< Node > node_
 The Kokkos Node instance given to this object's constructor.

Initialization of graph and matrix

void setGraphAndMatrix (const RCP< const DefaultCrsGraph< Ordinal, Node > > &graph, const RCP< const DefaultCrsMatrix< Scalar, Ordinal, Node > > &matrix)
static ArrayRCP< size_t > allocRowPtrs (const RCP< Node > &node, const ArrayView< const size_t > &numEntriesPerRow)
 Allocate and initialize the storage for the matrix values.
template<class T >
static ArrayRCP< T > allocStorage (const RCP< Node > &node, const ArrayView< const size_t > &rowPtrs)
 Allocate and initialize the storage for a sparse graph.
static void finalizeGraph (Teuchos::EUplo uplo, Teuchos::EDiag diag, DefaultCrsGraph< Ordinal, Node > &graph, const RCP< ParameterList > &params)
 Finalize a graph.
static void finalizeMatrix (const DefaultCrsGraph< Ordinal, Node > &graph, DefaultCrsMatrix< Scalar, Ordinal, Node > &matrix, const RCP< ParameterList > &params)
 Finalize the matrix of an already-finalized graph.
static void finalizeGraphAndMatrix (Teuchos::EUplo uplo, Teuchos::EDiag diag, DefaultCrsGraph< Ordinal, Node > &graph, DefaultCrsMatrix< Scalar, Ordinal, Node > &matrix, const RCP< ParameterList > &params)
 Finalize a graph and a matrix.

Detailed Description

template<class Scalar, class Ordinal, class Node, class Allocator = details::DefaultCRSAllocator>
class Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >

Default implementation of sparse matrix-vector multiply and solve routines, for host-based Kokkos Node types.

Template Parameters:
ScalarThe type of entries of the sparse matrix.
OrdinalThe type of (local) indices of the sparse matrix.
NodeThe Kokkos Node type.

Definition at line 340 of file Kokkos_DefaultSparseOps.hpp.


Member Typedef Documentation

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
typedef Scalar Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::scalar_type

The type of the individual entries of the sparse matrix.

Definition at line 346 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
typedef Ordinal Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::ordinal_type

The type of the (local) indices describing the structure of the sparse matrix.

Definition at line 348 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
typedef Node Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::node_type

The Kokkos Node type.

Definition at line 350 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
typedef DefaultHostSparseOps<Scalar,Ordinal,Node,Allocator> Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::sparse_ops_type

The type of this object, the sparse operator object.

Definition at line 352 of file Kokkos_DefaultSparseOps.hpp.


Constructor & Destructor Documentation

template<class Scalar , class Ordinal , class Node , class Allocator >
Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::DefaultHostSparseOps ( const RCP< Node > &  node)

Constructor accepting and retaining a node object.

Definition at line 836 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::DefaultHostSparseOps ( const RCP< Node > &  node,
Teuchos::ParameterList params 
)

Constructor accepting and retaining a node object, and taking parameters.

Definition at line 851 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::~DefaultHostSparseOps ( )

Destructor.

Definition at line 867 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::DefaultHostSparseOps ( const DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator > &  source) [protected]

Copy constructor (protected and unimplemented)


Member Function Documentation

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
std::string Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::description ( ) const [inline, virtual]

One-line description of this instance.

Reimplemented from Teuchos::Describable.

Definition at line 431 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::describe ( Teuchos::FancyOStream out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const [inline, virtual]

Write a possibly more verbose description of this instance to out.

Reimplemented from Teuchos::Describable.

Definition at line 444 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
Teuchos::RCP<Teuchos::SerialDenseMatrix<int, scalar_type> > Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::asDenseMatrix ( ) const [inline]

Convert to dense matrix and return.

Warning:
This method is for debugging only. It uses a lot of memory. Users should never call this method. Do not rely on this method continuing to exist in future releases.

Definition at line 539 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
RCP< Node > Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::getNode ( ) const

The Kokkos Node with which this object was instantiated.

Definition at line 871 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
static ArrayRCP<size_t> Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::allocRowPtrs ( const RCP< Node > &  node,
const ArrayView< const size_t > &  numEntriesPerRow 
) [inline, static]

Allocate and initialize the storage for the matrix values.

Definition at line 602 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
template<class T >
static ArrayRCP<T> Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::allocStorage ( const RCP< Node > &  node,
const ArrayView< const size_t > &  rowPtrs 
) [inline, static]

Allocate and initialize the storage for a sparse graph.

Definition at line 609 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::finalizeGraph ( Teuchos::EUplo  uplo,
Teuchos::EDiag  diag,
DefaultCrsGraph< Ordinal, Node > &  graph,
const RCP< ParameterList > &  params 
) [static]

Finalize a graph.

Definition at line 796 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::finalizeMatrix ( const DefaultCrsGraph< Ordinal, Node > &  graph,
DefaultCrsMatrix< Scalar, Ordinal, Node > &  matrix,
const RCP< ParameterList > &  params 
) [static]

Finalize the matrix of an already-finalized graph.

Definition at line 816 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::finalizeGraphAndMatrix ( Teuchos::EUplo  uplo,
Teuchos::EDiag  diag,
DefaultCrsGraph< Ordinal, Node > &  graph,
DefaultCrsMatrix< Scalar, Ordinal, Node > &  matrix,
const RCP< ParameterList > &  params 
) [static]

Finalize a graph and a matrix.

Definition at line 827 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::setGraphAndMatrix ( const RCP< const DefaultCrsGraph< Ordinal, Node > > &  graph,
const RCP< const DefaultCrsMatrix< Scalar, Ordinal, Node > > &  matrix 
)

Initialize sparse operations with a graph and matrix

Parameters:
uplo[in] UPPER_TRI if the matrix is upper triangular, else LOWER_TRI if the matrix is lower triangular.
diag[in] UNIT_DIAG if the matrix has an implicit unit diagonal, else NON_UNIT_DIAG (diagonal entries are explicitly stored in the matrix).

Definition at line 876 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
template<class DomainScalar , class RangeScalar >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::multiply ( Teuchos::ETransp  trans,
RangeScalar  alpha,
const MultiVector< DomainScalar, Node > &  X,
MultiVector< RangeScalar, Node > &  Y 
) const

Y := alpha * Op(A) * X.

Apply the local sparse matrix A (or its transpose or conjugate transpose) to a multivector X, overwriting Y with the result. Op(A) means A, the transpose of A, or the conjugate transpose of A, depending on the trans argument.

Note:
This method does not respect the implicit unit diagonal indication. If you want to simulate having an implicitly stored unit diagonal for the operation Y := A*X, you must compute Y := X + A*X instead.
Template Parameters:
DomainScalarThe type of entries in the input multivector X. This may differ from the type of entries in A or in Y.
RangeScalarThe type of entries in the output multivector Y. This may differ from the type of entries in A or in X.
Parameters:
trans[in] Whether to apply the matrix, its transpose, or its conjugate transpose (if applicable).
alpha[in] Scalar constant $\alpha$ by which to multiply the result of the sparse matrix-(multi)vector multiply.
X[in] Input multivector.
Y[out] Result multivector. Contents will be overwritten.

Definition at line 1067 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
template<class DomainScalar , class RangeScalar >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::multiply ( Teuchos::ETransp  trans,
RangeScalar  alpha,
const MultiVector< DomainScalar, Node > &  X,
RangeScalar  beta,
MultiVector< RangeScalar, Node > &  Y 
) const

Y := beta * Y + alpha * Op(A) * X.

Apply the local sparse matrix A (or its transpose or conjugate transpose) to a multivector X, accumulating the result into Y. Op(A) means A, the transpose of A, or the conjugate transpose of A, depending on the trans argument.

Note:
This method does not respect the implicit unit diagonal indication. If you want to simulate having an implicitly stored unit diagonal for the operation Y := A*X, you must compute Y := X + A*X instead.
Template Parameters:
DomainScalarThe type of entries in the input multivector X. This may differ from the type of entries in A or in Y.
RangeScalarThe type of entries in the output multivector Y. This may differ from the type of entries in A or in X.
Parameters:
trans[in] Whether to apply the matrix, its transpose, or its conjugate transpose (if applicable).
alpha[in] Scalar constant $\alpha$ by which to multiply the result of the sparse matrix-(multi)vector multiply.
X[in] Input multivector.
beta[in] Scalar constant $\beta$ by which to multiply Y when summing with the result of the sparse matrix-(multi)vector multiply.
Y[in/out] Result multivector.

Definition at line 1156 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node , class Allocator >
template<class DomainScalar , class RangeScalar >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::solve ( Teuchos::ETransp  trans,
const MultiVector< DomainScalar, Node > &  Y,
MultiVector< RangeScalar, Node > &  X 
) const

Solve Y = Op(A) X for X, where we assume A is triangular.

Solve the (upper or lower) triangular system Y = Op(A) X. Op(A) means A, the transpose of A, or the conjugate transpose of A, depending on the trans argument.

Template Parameters:
DomainScalarThe type of entries in the input multivector X. This may differ from the type of entries in A or in Y.
RangeScalarThe type of entries in the output multivector Y. This may differ from the type of entries in A or in X.
Parameters:
trans[in] Whether to solve with the matrix, its transpose, or its conjugate transpose (if applicable).
Y[in] Input multivector.
X[out] Result multivector.

Definition at line 975 of file Kokkos_DefaultSparseOps.hpp.


Member Data Documentation

template<class Scalar , class Ordinal , class Node , class Allocator = details::DefaultCRSAllocator>
RCP<Node> Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >::node_ [protected]

The Kokkos Node instance given to this object's constructor.

Definition at line 776 of file Kokkos_DefaultSparseOps.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends