42#ifndef STOKHOS_SYMMETRIC_DIAGONAL_SPEC_HPP
43#define STOKHOS_SYMMETRIC_DIAGONAL_SPEC_HPP
45#include "Kokkos_StaticCrsGraph.hpp"
62template<
class ExecutionSpace >
69 KOKKOS_INLINE_FUNCTION
73 KOKKOS_INLINE_FUNCTION
74 unsigned matrix_offset(
const unsigned row ,
const unsigned column )
const
77 const int diag = (int) column - (
int) row ;
81 if ( ( 0 <=
diag &&
diag < diag_count ) || (
diag <= - diag_count ) ) {
92 KOKKOS_INLINE_FUNCTION
114template <
typename Device >
119 typedef SymmetricDiagonalSpec< execution_space >
block_type ;
121 template<
typename MatrixValue ,
typename VectorValue >
122 KOKKOS_INLINE_FUNCTION
124 const MatrixValue * a ,
125 const VectorValue *
const x ,
126 VectorValue *
const y )
128 const size_type dimension = block.dimension();
129 const size_type dim_half = ( dimension + 1 ) >> 1 ;
133 y[
j] += a[
j] * x[
j] ;
137 for (
size_type d = 1 ; d < dim_half ; ++d ) {
144 y[
j] += a[
j] * x[kx] + a[kxr] * x[kxr];
145 if ( dimension == ++kx ) kx = 0 ;
146 if ( dimension == ++kxr ) kxr = 0 ;
151 if ( ! ( dimension & 01 ) ) {
157 y[
j] += a[
j] * x[kx] ;
158 y[kx] += a[
j] * x[
j] ;
163 KOKKOS_INLINE_FUNCTION
165 {
return block.matrix_size(); }
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)
execution_space::size_type size_type
SymmetricDiagonalSpec< execution_space > block_type
Symmetric diagonal storage for a dense matrix.
KOKKOS_INLINE_FUNCTION unsigned matrix_offset(const unsigned row, const unsigned column) const
Storage location for the (row,column) entry.
KOKKOS_INLINE_FUNCTION unsigned dimension() const
Dimension of vector block.
KOKKOS_INLINE_FUNCTION unsigned matrix_size() const
Storage size for block coefficients.
SymmetricDiagonalSpec(const unsigned dim)
SymmetricDiagonalSpec(const SymmetricDiagonalSpec &rhs)
Top-level namespace for Stokhos classes and functions.