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

Stub showing the interface that a Kokkos sparse operations provider must implement. More...

#include <KokkosExamples_EmptySparseKernelClass.hpp>

List of all members.

Classes

struct  bind_scalar
 Rebind struct, for specifying type information for a different scalar. 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 entries of the sparse matrix.
typedef void ordinal_type
 The type of (local) indices of the sparse matrix.
typedef Node node_type
 The Kokos Node type.
typedef EmptySparseKernel
< Scalar, Node > 
sparse_ops_type
 The type of this object: typeof(*this)

Public Member Functions

Constructors/Destructor
 EmptySparseKernel (const RCP< Node > &node)
 Constructor accepting and retaining a Kokkos Node instance.
 ~EmptySparseKernel ()
 Destructor.
Accessor routines.
RCP< Node > getNode () const
 Kokkos Node accessor.
Computational methods
template<class DomainScalar , class RangeScalar >
void multiply (Teuchos::ETransp trans, RangeScalar alpha, const Kokkos::MultiVector< DomainScalar, Node > &X, Kokkos::MultiVector< RangeScalar, Node > &Y) const
 Y := alpha * Op(A) * X.
template<class DomainScalar , class RangeScalar >
void multiply (Teuchos::ETransp trans, RangeScalar alpha, const Kokkos::MultiVector< DomainScalar, Node > &X, RangeScalar beta, Kokkos::MultiVector< RangeScalar, Node > &Y) const
 Y := Y + alpha * Op(A) * X.
template<class DomainScalar , class RangeScalar >
void solve (Teuchos::ETransp trans, const Kokkos::MultiVector< DomainScalar, Node > &Y, Kokkos::MultiVector< RangeScalar, Node > &X) const
 Solve Y = Op(A) X for X, where we assume A is triangular.

Protected Member Functions

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

Protected Attributes

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

Initialization of structure

void setGraphAndMatrix (const RCP< const EmptyCrsGraph< Node > > &graph, const RCP< const EmptyCrsMatrix< Scalar, Node > > &node)
 Initialize the kernels with the graph and 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, EmptyCrsGraph< Node > &graph, const RCP< ParameterList > &params)
 Finalize a graph.
static void finalizeMatrix (const EmptyCrsGraph< Node > &graph, EmptyCrsMatrix< Scalar, Node > &matrix, const RCP< ParameterList > &params)
 Finalize the matrix of an already-finalized graph.
static void finalizeGraphAndMatrix (Teuchos::EUplo uplo, Teuchos::EDiag diag, EmptyCrsGraph< Node > &graph, EmptyCrsMatrix< Scalar, Node > &matrix, const RCP< ParameterList > &params)
 Finalize a graph and a matrix.

Detailed Description

template<class Scalar, class Node>
class KokkosExamples::EmptySparseKernel< Scalar, Node >

Stub showing the interface that a Kokkos sparse operations provider must implement.

This class implements the Kokkos Compressed-Row Sparse API, which in turn is the interface required by the LocalMatOps template parameter of Tpetra::CrsMatrix. The implementation is trivial (it does nothing), but the interface is right, so you can use it as an example for writing your own implementation of local sparse kernels.

Template Parameters:
NodeA Kokkos Node type (that implements the Kokkos Node API).
Examples:

EmptySparseKernelDriver.cpp.

Definition at line 102 of file KokkosExamples_EmptySparseKernelClass.hpp.


Member Typedef Documentation

template<class Scalar , class Node >
typedef Scalar KokkosExamples::EmptySparseKernel< Scalar, Node >::scalar_type

The type of entries of the sparse matrix.

This is void only because this is a stub implementation. In a real implementation, scalar_type would normally either be a fixed type (like double) or a template parameter of your class.

Definition at line 113 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
typedef void KokkosExamples::EmptySparseKernel< Scalar, Node >::ordinal_type

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

This is void only because this is a stub implementation. In a real implementation, ordinal_type would normally either be a fixed type (like int) or a template parameter of your class.

Definition at line 120 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
typedef Node KokkosExamples::EmptySparseKernel< Scalar, Node >::node_type

The Kokos Node type.

Definition at line 122 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
typedef EmptySparseKernel<Scalar,Node> KokkosExamples::EmptySparseKernel< Scalar, Node >::sparse_ops_type

The type of this object: typeof(*this)

Definition at line 124 of file KokkosExamples_EmptySparseKernelClass.hpp.


Constructor & Destructor Documentation

template<class Scalar , class Node >
KokkosExamples::EmptySparseKernel< Scalar, Node >::EmptySparseKernel ( const RCP< Node > &  node) [inline]

Constructor accepting and retaining a Kokkos Node instance.

Definition at line 162 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
KokkosExamples::EmptySparseKernel< Scalar, Node >::~EmptySparseKernel ( ) [inline]

Destructor.

Definition at line 165 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
KokkosExamples::EmptySparseKernel< Scalar, Node >::EmptySparseKernel ( const EmptySparseKernel< Scalar, Node > &  source) [protected]

Copy constructor (protected and unimplemented)


Member Function Documentation

template<class Scalar , class Node >
RCP<Node> KokkosExamples::EmptySparseKernel< Scalar, Node >::getNode ( ) const [inline]

Kokkos Node accessor.

Return the Kokkos Node instance of type this::node_type given to the constructor.

Definition at line 175 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
static ArrayRCP<size_t> KokkosExamples::EmptySparseKernel< Scalar, Node >::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 182 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
template<class T >
static ArrayRCP<T> KokkosExamples::EmptySparseKernel< Scalar, Node >::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 189 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
static void KokkosExamples::EmptySparseKernel< Scalar, Node >::finalizeGraph ( Teuchos::EUplo  uplo,
Teuchos::EDiag  diag,
EmptyCrsGraph< Node > &  graph,
const RCP< ParameterList > &  params 
) [inline, static]

Finalize a graph.

Definition at line 195 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
static void KokkosExamples::EmptySparseKernel< Scalar, Node >::finalizeMatrix ( const EmptyCrsGraph< Node > &  graph,
EmptyCrsMatrix< Scalar, Node > &  matrix,
const RCP< ParameterList > &  params 
) [inline, static]

Finalize the matrix of an already-finalized graph.

Definition at line 198 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
static void KokkosExamples::EmptySparseKernel< Scalar, Node >::finalizeGraphAndMatrix ( Teuchos::EUplo  uplo,
Teuchos::EDiag  diag,
EmptyCrsGraph< Node > &  graph,
EmptyCrsMatrix< Scalar, Node > &  matrix,
const RCP< ParameterList > &  params 
) [inline, static]

Finalize a graph and a matrix.

Definition at line 201 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
void KokkosExamples::EmptySparseKernel< Scalar, Node >::setGraphAndMatrix ( const RCP< const EmptyCrsGraph< Node > > &  graph,
const RCP< const EmptyCrsMatrix< Scalar, Node > > &  node 
) [inline]

Initialize the kernels with the graph and matrix.

This is the mechanism by which the user specifies the structure and values for the sparse matrix ops.

setGraphAndMatrix() must be called before calling multiply() or solve().

After initializeStructure() completes, the caller is responsible for deciding what to do with the graph and matrix objects. Since your implementation may choose just to view the original CrsGraph data instead of making a deep copy, callers should not change the Kokkos::CrsGraph after calling this method.

Definition at line 217 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
template<class DomainScalar , class RangeScalar >
void KokkosExamples::EmptySparseKernel< Scalar, Node >::multiply ( Teuchos::ETransp  trans,
RangeScalar  alpha,
const Kokkos::MultiVector< DomainScalar, Node > &  X,
Kokkos::MultiVector< RangeScalar, Node > &  Y 
) const [inline]

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: $Y := \alpha A X$.
X[in] Input multivector.
Y[out] Result multivector.

Definition at line 250 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
template<class DomainScalar , class RangeScalar >
void KokkosExamples::EmptySparseKernel< Scalar, Node >::multiply ( Teuchos::ETransp  trans,
RangeScalar  alpha,
const Kokkos::MultiVector< DomainScalar, Node > &  X,
RangeScalar  beta,
Kokkos::MultiVector< RangeScalar, Node > &  Y 
) const [inline]

Y := 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: $Y := Y + \alpha A X$.
X[in] Input multivector.
Y[in/out] Result multivector.

Definition at line 282 of file KokkosExamples_EmptySparseKernelClass.hpp.

template<class Scalar , class Node >
template<class DomainScalar , class RangeScalar >
void KokkosExamples::EmptySparseKernel< Scalar, Node >::solve ( Teuchos::ETransp  trans,
const Kokkos::MultiVector< DomainScalar, Node > &  Y,
Kokkos::MultiVector< RangeScalar, Node > &  X 
) const [inline]

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).
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 unit diagonal, else NON_UNIT_DIAG.
Y[in] Input multivector.
X[out] Result multivector.

Definition at line 317 of file KokkosExamples_EmptySparseKernelClass.hpp.


Member Data Documentation

template<class Scalar , class Node >
RCP<Node> KokkosExamples::EmptySparseKernel< Scalar, Node >::node_ [protected]

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

Definition at line 328 of file KokkosExamples_EmptySparseKernelClass.hpp.


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