44 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
50 const ordering_type& coeff_compare) :
55 sparse_tol(sparse_tol_),
57 basis_set(coeff_compare),
76 MultiIndex<ordinal_type> orders(d);
79 TensorProductIndexSet<ordinal_type> index_set(orders);
94 name =
"Tensor product basis (";
105 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
111 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
119 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
127 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
135 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
143 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
151 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
156 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
163 bases, basis_set, basis_map, predicate, predicate, sparse_tol);
166 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
171 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
179 bases, basis_set, basis_map, predicate, k_predicate, sparse_tol);
182 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
191 z = z * bases[
j]->evaluate(
value_type(0.0), basis_map[i][
j]);
196 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
203 bases[
j]->evaluateBases(point[
j], basis_eval_tmp[j]);
209 t *= basis_eval_tmp[j][basis_map[i][j]];
214 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
219 os <<
"Tensor product basis of order " << p <<
", dimension " << d
220 <<
", and size " << sz <<
". Component bases:\n";
223 os <<
"Basis vector norms (squared):\n\t";
224 for (
ordinal_type i=0; i<static_cast<ordinal_type>(norms.size()); i++)
225 os << norms[i] <<
" ";
229 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
237 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
242 typename coeff_set_type::const_iterator it = basis_set.find(term);
244 "Invalid term " << term);
248 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
256 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
264 template <
typename ordinal_type,
typename value_type,
typename ordering_type>
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
ordinal_type order() const
Return order of basis.
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
SparseArrayIterator< index_iterator, value_iterator >::value_type index(const SparseArrayIterator< index_iterator, value_iterator > &it)
coeff_set_type basis_set
Basis set.
coeff_map_type basis_map
Basis map.
coeff_type max_orders
Maximum orders for each dimension.
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases() const
Return coordinate bases.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::Array< Teuchos::Array< value_type > > basis_eval_tmp
Temporary array used in basis evaluation.
ordinal_type dimension() const
Dimension.
static Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor(const Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > &bases, const basis_set_type &basis_set, const basis_map_type &basis_map, const coeff_predicate_type &coeff_pred, const k_coeff_predicate_type &k_coeff_pred, const value_type sparse_tol=1.0e-12)
static void buildProductBasis(const index_set_type &index_set, const growth_rule_type &growth_rule, basis_set_type &basis_set, basis_map_type &basis_map)
Generate a product basis from an index set.
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const
Get orders of each coordinate polynomial given an index i.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
virtual const std::string & getName() const
Return string name of basis.
ordinal_type sz
Total size of basis.
Teuchos::Array< value_type > norms
Norms.
virtual ~TensorProductBasis()
Destructor.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
void resize(size_type new_size, const value_type &x=value_type())
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
Predicate functor for building sparse triple products based on total order.
ordinal_type dimension() const
Return dimension of basis.
std::string name
Name of basis.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > bases
Array of bases.
ordinal_type d
Total dimension of basis.
virtual ordinal_type size() const
Return total size of basis.
ordinal_type p
Total order of basis.
TensorProductBasis(const Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > &bases, const value_type &sparse_tol=1.0e-12, const MultiIndex< ordinal_type > &index=MultiIndex< ordinal_type >(), const coeff_compare_type &coeff_compare=coeff_compare_type())
Constructor.
virtual void print(std::ostream &os) const
Print basis to stream os.
Predicate functor for building sparse triple products.
virtual ordinal_type index(const MultiIndex< ordinal_type > &term) const
Get index of the multivariate polynomial given orders of each coordinate.
virtual MultiIndex< ordinal_type > getMaxOrders() const
Return maximum order allowable for each coordinate basis.