10 #ifndef STOKHOS_SYMMETRIC_DIAGONAL_SPEC_HPP
11 #define STOKHOS_SYMMETRIC_DIAGONAL_SPEC_HPP
13 #include "Kokkos_StaticCrsGraph.hpp"
30 template<
class ExecutionSpace >
37 KOKKOS_INLINE_FUNCTION
41 KOKKOS_INLINE_FUNCTION
42 unsigned matrix_offset(
const unsigned row ,
const unsigned column )
const
45 const int diag = (int) column - (
int) row ;
49 if ( ( 0 <= diag && diag < diag_count ) || ( diag <= - diag_count ) ) {
60 KOKKOS_INLINE_FUNCTION
82 template <
typename Device >
86 typedef typename execution_space::size_type
size_type ;
89 template<
typename MatrixValue ,
typename VectorValue >
90 KOKKOS_INLINE_FUNCTION
92 const MatrixValue * a ,
93 const VectorValue *
const x ,
94 VectorValue *
const y )
97 const size_type dim_half = ( dimension + 1 ) >> 1 ;
101 y[
j] += a[
j] * x[
j] ;
105 for (
size_type d = 1 ; d < dim_half ; ++d ) {
112 y[
j] += a[
j] * x[kx] + a[kxr] * x[kxr];
113 if ( dimension == ++kx ) kx = 0 ;
114 if ( dimension == ++kxr ) kxr = 0 ;
119 if ( ! ( dimension & 01 ) ) {
125 y[
j] += a[
j] * x[kx] ;
126 y[kx] += a[
j] * x[
j] ;
131 KOKKOS_INLINE_FUNCTION
static KOKKOS_INLINE_FUNCTION size_type matrix_size(const block_type &block)
static KOKKOS_INLINE_FUNCTION void apply(const block_type &block, const MatrixValue *a, const VectorValue *const x, VectorValue *const y)
KOKKOS_INLINE_FUNCTION unsigned matrix_size() const
Storage size for block coefficients.
KOKKOS_INLINE_FUNCTION unsigned matrix_offset(const unsigned row, const unsigned column) const
Storage location for the (row,column) entry.
SymmetricDiagonalSpec(const SymmetricDiagonalSpec &rhs)
Symmetric diagonal storage for a dense matrix.
execution_space::size_type size_type
SymmetricDiagonalSpec(const unsigned dim)
SymmetricDiagonalSpec< execution_space > block_type
KOKKOS_INLINE_FUNCTION unsigned dimension() const
Dimension of vector block.