10 #ifndef STOKHOS_TOTAL_ORDER_BASIS_HPP
11 #define STOKHOS_TOTAL_ORDER_BASIS_HPP
34 typename coeff_compare_type =
35 TotalOrderLess<MultiIndex<ordinal_type> > >
50 const coeff_compare_type& coeff_compare = coeff_compare_type());
106 virtual void print(std::ostream& os)
const;
109 virtual const std::string&
getName()
const;
207 bool symmetric =
false) {
208 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
220 for (
int i=0; i<d; ++i)
221 basis_orders[i] = bases[i]->order();
227 bases[i]->computeSparseTripleProductTensor(bases[i]->order()+1);
236 coeff_type terms_i(d,0), terms_j(d,0), terms_k(d,0);
239 Cijk_1d_iterators[dim] = Cijk_Iterator(bases[dim]->order(), symmetric);
251 terms_i[dim] = Cijk_1d_iterators[dim].i;
252 terms_j[dim] = Cijk_1d_iterators[dim].j;
253 terms_k[dim] = Cijk_1d_iterators[dim].k;
272 c *= Cijk_1d[dim]->getValue(Cijk_1d_iterators[dim].i,
273 Cijk_1d_iterators[dim].
j,
274 Cijk_1d_iterators[dim].k);
280 "Got 0 triple product value " << c
281 <<
", I = " << I <<
" = " << terms_i
282 <<
", J = " << J <<
" = " << terms_j
283 <<
", K = " << K <<
" = " << terms_k
287 Cijk->add_term(I,J,K,c);
297 while (inc && cdim >= 0) {
300 Cijk_1d_iterators[cdim].increment(delta_i, delta_j, delta_k);
313 basis_orders[cdim+1]-sum_i[cdim] -
314 (Cijk_1d_iterators[cdim].i-ii)+d-cdim,
321 basis_orders[cdim+1]-sum_i[cdim] -
322 (Cijk_1d_iterators[cdim].i+ii)+d-cdim-1,
330 basis_orders[cdim+1]-sum_j[cdim] -
331 (Cijk_1d_iterators[cdim].
j-jj)+d-cdim,
338 basis_orders[cdim+1]-sum_j[cdim] -
339 (Cijk_1d_iterators[cdim].
j+jj)+d-cdim-1,
347 basis_orders[cdim+1]-sum_k[cdim] -
348 (Cijk_1d_iterators[cdim].k-kk)+d-cdim,
355 basis_orders[cdim+1]-sum_k[cdim] -
356 (Cijk_1d_iterators[cdim].k+kk)+d-cdim-1,
373 sum_i[dim] = sum_i[dim-1] + Cijk_1d_iterators[dim-1].i;
374 sum_j[dim] = sum_j[dim-1] + Cijk_1d_iterators[dim-1].j;
375 sum_k[dim] = sum_k[dim-1] + Cijk_1d_iterators[dim-1].k;
378 Cijk_1d_iterators[dim] =
379 Cijk_Iterator(basis_orders[dim]-sum_i[dim],
380 basis_orders[dim]-sum_j[dim],
381 basis_orders[dim]-sum_k[dim],
393 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.