42 #ifndef STOKHOS_STOCHASTICPRODUCTTENSOR_HPP 43 #define STOKHOS_STOCHASTICPRODUCTTENSOR_HPP 47 #include "Kokkos_Core.hpp" 50 #include "Teuchos_ParameterList.hpp" 77 template<
typename ValueType ,
typename TensorType,
class Device >
120 KOKKOS_INLINE_FUNCTION
126 KOKKOS_INLINE_FUNCTION
131 KOKKOS_INLINE_FUNCTION
134 #if defined( KOKKOS_HAVE_CUDA ) 135 Kokkos::Impl::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.dimension_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 );
218 template<
typename TensorType,
typename OrdinalType ,
typename ValueType,
typename CijkType >
219 StochasticProductTensor<ValueType, TensorType, typename TensorType::execution_space>
222 const CijkType& Cijk,
223 const Teuchos::ParameterList& params = Teuchos::ParameterList())
227 basis, Cijk, params);
230 template <
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 );
StochasticProductTensor & operator=(const StochasticProductTensor &rhs)
Bases defined by combinatorial product of polynomial bases.
execution_space::size_type size_type
KOKKOS_INLINE_FUNCTION size_type aligned_dimension() const
Aligned dimension: length of the vector block properly aligned.
static KOKKOS_INLINE_FUNCTION void apply(const block_type &block, const MatrixValue *a, const VectorValue *const x, VectorValue *const y)
Kokkos::DefaultExecutionSpace execution_space
~StochasticProductTensor()
static StochasticProductTensor create(const Stokhos::ProductBasis< OrdinalType, ValueType > &basis, const CijkType &Cijk, const Teuchos::ParameterList ¶ms=Teuchos::ParameterList())
virtual ordinal_type dimension() const =0
Return dimension of basis.
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...
A multidimensional index.
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const =0
Get orders of each coordinate polynomial given an index i.
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
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())
void deep_copy(const Stokhos::CrsMatrix< ValueType, DstDevice, Layout > &dst, const Stokhos::CrsMatrix< ValueType, SrcDevice, Layout > &src)
void print(std::ostream &s) const
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
KOKKOS_INLINE_FUNCTION const tensor_type & tensor() const
KOKKOS_INLINE_FUNCTION size_type variable_degree(const iType &iVariable) const
Polynomial degree of a given variable.
tensor_type::size_type size_type
StochasticProductTensor()
KOKKOS_INLINE_FUNCTION size_type variable_count() const
How many variables are being expanded.
Kokkos::View< size_type **, execution_space > m_degree_map
KOKKOS_INLINE_FUNCTION size_type dimension() const
Dimension: number of bases and length of the vector block (and tensor).
StochasticProductTensor< ValueType, TensorType, execution_space > block_type
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType ValueType * y
virtual ordinal_type size() const =0
Return total size of basis.
virtual MultiIndex< ordinal_type > getMaxOrders() const =0
Return maximum order allowable for each coordinate basis.
Stokhos::CrsMatrix< ValueType, Device, Layout >::HostMirror create_mirror_view(const Stokhos::CrsMatrix< ValueType, Device, Layout > &A)