42#ifndef STOKHOS_STOCHASTICPRODUCTTENSOR_HPP
43#define STOKHOS_STOCHASTICPRODUCTTENSOR_HPP
47#include "Kokkos_Core.hpp"
50#include "Teuchos_ParameterList.hpp"
77template<
typename ValueType ,
typename TensorType,
class Device >
120 KOKKOS_INLINE_FUNCTION
126 KOKKOS_INLINE_FUNCTION
131 KOKKOS_INLINE_FUNCTION
134#if defined( KOKKOS_ENABLE_CUDA )
135 std::is_same<execution_space,Kokkos::Cuda>::value;
139 const size_type AlignBytes = is_cuda ? 128 : 64;
141 return (
dimension() + NumAlign-1) & ~(NumAlign-1);
145 KOKKOS_INLINE_FUNCTION
149 template<
typename iType >
150 KOKKOS_INLINE_FUNCTION
158 template<
typename iType ,
typename jType >
159 KOKKOS_INLINE_FUNCTION
163 void print( std::ostream & s )
const
165 for (
unsigned i = 1 ; i <
m_degree_map.extent(0) ; ++i ) {
166 s <<
" bases[" << i - 1 <<
"] (" ;
170 s <<
" )" << std::endl ;
174 template <
typename OrdinalType,
typename CijkType>
177 const CijkType& Cijk,
178 const Teuchos::ParameterList& params = Teuchos::ParameterList())
184 typedef Kokkos::View< size_type** , execution_space > int_array_type ;
185 typedef typename int_array_type::HostMirror host_int_array_type ;
187 OrdinalType basis_sz = basis.
size();
188 OrdinalType basis_dim = basis.
dimension();
192 int_array_type(
"stochastic_tensor_degree_map" ,
199 host_int_array_type degree_map =
201 for ( OrdinalType
j = 0 ;
j < basis_dim ; ++
j )
202 degree_map(0,
j) = max_orders[
j];
203 for ( OrdinalType i = 0 ; i < basis_sz ; ++i ) {
205 for ( OrdinalType
j = 0 ;
j < basis_dim ; ++
j ) {
206 degree_map(i+1,
j) = term[
j];
212 spt.
m_tensor = tensor_type::create( basis, Cijk, params );
218template<
typename TensorType,
typename OrdinalType ,
typename ValueType,
typename CijkType >
219StochasticProductTensor<ValueType, TensorType, typename TensorType::execution_space>
222 const CijkType& Cijk,
223 const Teuchos::ParameterList& params = Teuchos::ParameterList())
225 typedef typename TensorType::execution_space Device;
227 basis, Cijk, params);
230template <
typename ValueType ,
typename Device,
class TensorType >
238 template<
typename MatrixValue ,
typename VectorValue >
239 KOKKOS_INLINE_FUNCTION
241 const MatrixValue * a ,
242 const VectorValue *
const x ,
243 VectorValue *
const y )
247 tensor_multiply::apply( block.
tensor() , a , x , y );
execution_space::size_type size_type
static KOKKOS_INLINE_FUNCTION void apply(const block_type &block, const MatrixValue *a, const VectorValue *const x, VectorValue *const y)
StochasticProductTensor< ValueType, TensorType, execution_space > block_type
A multidimensional index.
virtual ordinal_type size() const =0
Return total size of basis.
virtual ordinal_type dimension() const =0
Return dimension of basis.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
virtual MultiIndex< ordinal_type > getMaxOrders() const =0
Return maximum order allowable for each coordinate basis.
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const =0
Get orders of each coordinate polynomial given an index i.
Bases defined by combinatorial product of polynomial bases.
KOKKOS_INLINE_FUNCTION size_type variable_count() const
How many variables are being expanded.
KOKKOS_INLINE_FUNCTION size_type dimension() const
Dimension: number of bases and length of the vector block (and tensor).
Kokkos::View< size_type **, execution_space > m_degree_map
KOKKOS_INLINE_FUNCTION size_type variable_degree(const iType &iVariable) const
Polynomial degree of a given variable.
static StochasticProductTensor create(const Stokhos::ProductBasis< OrdinalType, ValueType > &basis, const CijkType &Cijk, const Teuchos::ParameterList ¶ms=Teuchos::ParameterList())
KOKKOS_INLINE_FUNCTION size_type bases_degree(const iType &iBasis, const jType &iVariable) const
Basis function 'iBasis' is the product of 'variable_count()' polynomials. Return the polynomial degre...
tensor_type::size_type size_type
StochasticProductTensor & operator=(const StochasticProductTensor &rhs)
void print(std::ostream &s) const
KOKKOS_INLINE_FUNCTION size_type aligned_dimension() const
Aligned dimension: length of the vector block properly aligned.
StochasticProductTensor()
KOKKOS_INLINE_FUNCTION const tensor_type & tensor() const
~StochasticProductTensor()
StochasticProductTensor(const StochasticProductTensor &rhs)
Top-level namespace for Stokhos classes and functions.
StochasticProductTensor< ValueType, TensorType, typename TensorType::execution_space > create_stochastic_product_tensor(const Stokhos::ProductBasis< OrdinalType, ValueType > &basis, const CijkType &Cijk, const Teuchos::ParameterList ¶ms=Teuchos::ParameterList())