10 #ifndef STOKHOS_SYMMETRIC_DIAGONAL_SPEC_HPP
11 #define STOKHOS_SYMMETRIC_DIAGONAL_SPEC_HPP
29 template<
class ExecutionSpace >
36 KOKKOS_INLINE_FUNCTION
40 KOKKOS_INLINE_FUNCTION
41 unsigned matrix_offset(
const unsigned row ,
const unsigned column )
const
44 const int diag = (int) column - (
int) row ;
48 if ( ( 0 <= diag && diag < diag_count ) || ( diag <= - diag_count ) ) {
59 KOKKOS_INLINE_FUNCTION
81 template <
typename Device >
85 typedef typename execution_space::size_type
size_type ;
88 template<
typename MatrixValue ,
typename VectorValue >
89 KOKKOS_INLINE_FUNCTION
91 const MatrixValue * a ,
92 const VectorValue *
const x ,
93 VectorValue *
const y )
96 const size_type dim_half = ( dimension + 1 ) >> 1 ;
100 y[
j] += a[
j] * x[
j] ;
104 for (
size_type d = 1 ; d < dim_half ; ++d ) {
111 y[
j] += a[
j] * x[kx] + a[kxr] * x[kxr];
112 if ( dimension == ++kx ) kx = 0 ;
113 if ( dimension == ++kxr ) kxr = 0 ;
118 if ( ! ( dimension & 01 ) ) {
124 y[
j] += a[
j] * x[kx] ;
125 y[kx] += a[
j] * x[
j] ;
130 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.