42 #ifndef STOKHOS_TOTAL_ORDER_BASIS_HPP
43 #define STOKHOS_TOTAL_ORDER_BASIS_HPP
66 typename coeff_compare_type =
67 TotalOrderLess<MultiIndex<ordinal_type> > >
82 const coeff_compare_type& coeff_compare = coeff_compare_type());
138 virtual void print(std::ostream& os)
const;
141 virtual const std::string&
getName()
const;
239 bool symmetric =
false) {
240 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
252 for (
int i=0; i<d; ++i)
253 basis_orders[i] = bases[i]->order();
259 bases[i]->computeSparseTripleProductTensor(bases[i]->order()+1);
268 coeff_type terms_i(d,0), terms_j(d,0), terms_k(d,0);
271 Cijk_1d_iterators[dim] = Cijk_Iterator(bases[dim]->order(), symmetric);
283 terms_i[dim] = Cijk_1d_iterators[dim].i;
284 terms_j[dim] = Cijk_1d_iterators[dim].j;
285 terms_k[dim] = Cijk_1d_iterators[dim].k;
304 c *= Cijk_1d[dim]->getValue(Cijk_1d_iterators[dim].i,
305 Cijk_1d_iterators[dim].
j,
306 Cijk_1d_iterators[dim].k);
312 "Got 0 triple product value " << c
313 <<
", I = " << I <<
" = " << terms_i
314 <<
", J = " << J <<
" = " << terms_j
315 <<
", K = " << K <<
" = " << terms_k
319 Cijk->add_term(I,J,K,c);
329 while (inc && cdim >= 0) {
332 Cijk_1d_iterators[cdim].increment(delta_i, delta_j, delta_k);
345 basis_orders[cdim+1]-sum_i[cdim] -
346 (Cijk_1d_iterators[cdim].i-ii)+d-cdim,
353 basis_orders[cdim+1]-sum_i[cdim] -
354 (Cijk_1d_iterators[cdim].i+ii)+d-cdim-1,
362 basis_orders[cdim+1]-sum_j[cdim] -
363 (Cijk_1d_iterators[cdim].
j-jj)+d-cdim,
370 basis_orders[cdim+1]-sum_j[cdim] -
371 (Cijk_1d_iterators[cdim].
j+jj)+d-cdim-1,
379 basis_orders[cdim+1]-sum_k[cdim] -
380 (Cijk_1d_iterators[cdim].k-kk)+d-cdim,
387 basis_orders[cdim+1]-sum_k[cdim] -
388 (Cijk_1d_iterators[cdim].k+kk)+d-cdim-1,
405 sum_i[dim] = sum_i[dim-1] + Cijk_1d_iterators[dim-1].i;
406 sum_j[dim] = sum_j[dim-1] + Cijk_1d_iterators[dim-1].j;
407 sum_k[dim] = sum_k[dim-1] + Cijk_1d_iterators[dim-1].k;
410 Cijk_1d_iterators[dim] =
411 Cijk_Iterator(basis_orders[dim]-sum_i[dim],
412 basis_orders[dim]-sum_j[dim],
413 basis_orders[dim]-sum_k[dim],
425 Cijk->fillComplete();
Teuchos::Array< value_type > norms
Norms.
coeff_map_type basis_map
Basis map.
virtual ordinal_type size() const
Return total size of basis.
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
Teuchos::Array< Teuchos::Array< value_type > > basis_eval_tmp
Temporary array used in basis evaluation.
ordinal_type n_choose_k(const ordinal_type &n, const ordinal_type &k)
Compute bionomial coefficient (n ; k) = n!/( k! (n-k)! )
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const
Get orders of each coordinate polynomial given an index i.
Teuchos::RCP< Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensorLTO(const TotalOrderBasis< ordinal_type, value_type, LexographicLess< MultiIndex< ordinal_type > > > &product_basis, bool symmetric=false)
Multivariate orthogonal polynomial basis generated from a total order tensor product of univariate po...
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
ordinal_type sz
Total size of basis.
ordinal_type dimension() const
Return dimension of basis.
TotalOrderBasis & operator=(const TotalOrderBasis &b)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
coeff_type max_orders
Maximum orders for each dimension.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
TotalOrderBasis(const Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > &bases, const value_type &sparse_tol=1.0e-12, const coeff_compare_type &coeff_compare=coeff_compare_type())
Constructor.
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.
virtual MultiIndex< ordinal_type > getMaxOrders() const
Return maximum order allowable for each coordinate basis.
ordinal_type d
Total dimension of basis.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MultiIndex< ordinal_type > coeff_type
value_type sparse_tol
Tolerance for computing sparse Cijk.
Teuchos::Array< coeff_type > coeff_map_type
coeff_set_type basis_set
Basis set.
std::string name
Name of basis.
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
std::map< coeff_type, ordinal_type, coeff_compare_type > coeff_set_type
Abstract base class for 1-D orthogonal polynomials.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > bases
Array of bases.
A comparison functor implementing a strict weak ordering based lexographic ordering.
virtual ordinal_type index(const MultiIndex< ordinal_type > &term) const
Get index of the multivariate polynomial given orders of each coordinate.
ordinal_type order() const
Return order of basis.
virtual void print(std::ostream &os) const
Print basis to stream os.
virtual ~TotalOrderBasis()
Destructor.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases() const
Return coordinate bases.
virtual const std::string & getName() const
Return string name of basis.
ordinal_type p
Total order of basis.