Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Classes | Protected Member Functions | Protected Attributes
Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node > 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 >:
Inheritance graph
[legend]

List of all members.

Classes

struct  bind_scalar
 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 > 
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 ()
 Destructor.
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 Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >

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 236 of file Kokkos_DefaultSparseOps.hpp.


Member Typedef Documentation

template<class Scalar, class Ordinal, class Node>
typedef Scalar Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::scalar_type

The type of the individual entries of the sparse matrix.

Reimplemented in Kokkos::FirstTouchSparseOps< Scalar, Ordinal, Node >.

Definition at line 242 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar, class Ordinal, class Node>
typedef Ordinal Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::ordinal_type

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

Reimplemented in Kokkos::FirstTouchSparseOps< Scalar, Ordinal, Node >.

Definition at line 244 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar, class Ordinal, class Node>
typedef Node Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::node_type

The Kokkos Node type.

Reimplemented in Kokkos::FirstTouchSparseOps< Scalar, Ordinal, Node >.

Definition at line 246 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar, class Ordinal, class Node>
typedef DefaultHostSparseOps<Scalar,Ordinal,Node> Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::sparse_ops_type

The type of this object, the sparse operator object.

Reimplemented in Kokkos::FirstTouchSparseOps< Scalar, Ordinal, Node >.

Definition at line 248 of file Kokkos_DefaultSparseOps.hpp.


Constructor & Destructor Documentation

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

Constructor accepting and retaining a node object.

Definition at line 492 of file Kokkos_DefaultSparseOps.hpp.

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

Destructor.

Definition at line 505 of file Kokkos_DefaultSparseOps.hpp.

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

Copy constructor (protected and unimplemented)


Member Function Documentation

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

The Kokkos Node with which this object was instantiated.

Definition at line 509 of file Kokkos_DefaultSparseOps.hpp.

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

Allocate and initialize the storage for the matrix values.

Reimplemented in Kokkos::FirstTouchSparseOps< Scalar, Ordinal, Node >.

Definition at line 756 of file Kokkos_DefaultSparseOps.hpp.

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

Allocate and initialize the storage for a sparse graph.

Reimplemented in Kokkos::FirstTouchSparseOps< Scalar, Ordinal, Node >.

Definition at line 768 of file Kokkos_DefaultSparseOps.hpp.

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

Finalize a graph.

Definition at line 452 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::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 464 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::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 475 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::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 514 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node >
template<class DomainScalar , class RangeScalar >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::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.

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 619 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node >
template<class DomainScalar , class RangeScalar >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::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.

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 686 of file Kokkos_DefaultSparseOps.hpp.

template<class Scalar , class Ordinal , class Node >
template<class DomainScalar , class RangeScalar >
void Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node >::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 543 of file Kokkos_DefaultSparseOps.hpp.


Member Data Documentation

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

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

Definition at line 434 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