Stokhos Development
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
Stokhos::SmolyakBasis< ordinal_type, value_type, coeff_compare_type > Class Template Reference

Multivariate orthogonal polynomial basis generated from a Smolyak sparse grid. More...

#include <Stokhos_SmolyakBasis.hpp>

Inheritance diagram for Stokhos::SmolyakBasis< ordinal_type, value_type, coeff_compare_type >:
Inheritance graph
[legend]
Collaboration diagram for Stokhos::SmolyakBasis< ordinal_type, value_type, coeff_compare_type >:
Collaboration graph
[legend]

Classes

struct  SmolyakPredicate
 Predicate functor for building sparse triple products. More...
 

Public Member Functions

template<typename index_set_type >
 SmolyakBasis (const Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > &bases, const index_set_type &index_set, const value_type &sparse_tol=1.0e-12, const coeff_compare_type &coeff_compare=coeff_compare_type())
 Constructor.
 
virtual ~SmolyakBasis ()
 Destructor.
 
template<typename index_set_type >
 SmolyakBasis (const Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > &bases_, const index_set_type &index_set, const value_type &sparse_tol_, const ordering_type &coeff_compare)
 
Implementation of Stokhos::OrthogPolyBasis methods
ordinal_type order () const
 Return order of basis.
 
ordinal_type dimension () const
 Return dimension of basis.
 
virtual ordinal_type size () const
 Return total size of basis.
 
virtual const Teuchos::Array< value_type > & norm_squared () const
 Return array storing norm-squared of each basis polynomial.
 
virtual const value_type & norm_squared (ordinal_type i) const
 Return norm squared of basis polynomial i.
 
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor () const
 Compute triple product tensor.
 
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor () const
 Compute linear triple product tensor where k = 0,1,..,d.
 
virtual value_type evaluateZero (ordinal_type i) const
 Evaluate basis polynomial i at zero.
 
virtual void evaluateBases (const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
 Evaluate basis polynomials at given point point.
 
virtual void print (std::ostream &os) const
 Print basis to stream os.
 
virtual const std::string & getName () const
 Return string name of basis.
 
- Public Member Functions inherited from Stokhos::ProductBasis< ordinal_type, value_type >
 ProductBasis ()
 Constructor.
 
virtual ~ProductBasis ()
 Destructor.
 
virtual const MultiIndex< ordinal_type > & term (ordinal_type i) const =0
 Get orders of each coordinate polynomial given an index i.
 
virtual ordinal_type index (const MultiIndex< ordinal_type > &term) const =0
 Get index of the multivariate polynomial given orders of each coordinate.
 
virtual Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases () const =0
 Return array of coordinate bases.
 
virtual MultiIndex< ordinal_type > getMaxOrders () const =0
 Return maximum order allowable for each coordinate basis.
 
- Public Member Functions inherited from Stokhos::OrthogPolyBasis< ordinal_type, value_type >
 OrthogPolyBasis ()
 Constructor.
 
virtual ~OrthogPolyBasis ()
 Destructor.
 
virtual ordinal_type order () const =0
 Return order of basis.
 
virtual ordinal_type dimension () const =0
 Return dimension of basis.
 
virtual ordinal_type size () const =0
 Return total size of basis.
 
virtual const Teuchos::Array< value_type > & norm_squared () const =0
 Return array storing norm-squared of each basis polynomial.
 
virtual const value_type & norm_squared (ordinal_type i) const =0
 Return norm squared of basis polynomial i.
 
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor () const =0
 Compute triple product tensor.
 
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor () const =0
 Compute linear triple product tensor where k = 0,1.
 
virtual value_type evaluateZero (ordinal_type i) const =0
 Evaluate basis polynomial i at zero.
 
virtual void evaluateBases (const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const =0
 Evaluate basis polynomials at given point point.
 
virtual void print (std::ostream &os) const =0
 Print basis to stream os.
 
virtual const std::string & getName () const =0
 Return string name of basis.
 

Implementation of Stokhos::ProductBasis methods

typedef MultiIndex< ordinal_type > coeff_type
 
typedef TensorProductBasis< ordinal_type, value_type, LexographicLess< coeff_type > > tensor_product_basis_type
 
typedef std::map< coeff_type, ordinal_type, coeff_compare_type > coeff_set_type
 
typedef Teuchos::Array< coeff_typecoeff_map_type
 
typedef MultiIndex< ordinal_type > multiindex_type
 
std::string name
 Name of basis.
 
ordinal_type p
 Total order of basis.
 
ordinal_type d
 Total dimension of basis.
 
ordinal_type sz
 Total size of basis.
 
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > bases
 Array of bases.
 
value_type sparse_tol
 Tolerance for computing sparse Cijk.
 
coeff_type max_orders
 Maximum orders for each dimension.
 
coeff_set_type basis_set
 Basis set.
 
coeff_map_type basis_map
 Basis map.
 
Teuchos::Array< ordinal_type > smolyak_coeffs
 Smolyak coefficients.
 
Teuchos::Array< value_type > norms
 Norms.
 
Teuchos::Array< Teuchos::Array< value_type > > basis_eval_tmp
 Temporary array used in basis evaluation.
 
Teuchos::Array< Teuchos::RCP< tensor_product_basis_type > > tp_bases
 Tensor product bases comprising Smolyak set.
 
SmolyakPredicate< TensorProductPredicate< ordinal_type > > sm_pred
 Predicate for building sparse triple products.
 
virtual const MultiIndex< ordinal_type > & term (ordinal_type i) const
 Get orders of each coordinate polynomial given an index i.
 
virtual ordinal_type index (const MultiIndex< ordinal_type > &term) const
 Get index of the multivariate polynomial given orders of each coordinate.
 
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases () const
 Return coordinate bases.
 
virtual MultiIndex< ordinal_type > getMaxOrders () const
 Return maximum order allowable for each coordinate basis.
 
ordinal_type getNumSmolyakTerms () const
 Return number of terms in Smolyak formula.
 
Teuchos::RCP< const tensor_product_basis_typegetTensorProductBasis (ordinal_type i) const
 Return ith tensor product basis.
 
ordinal_type getSmolyakCoefficient (ordinal_type i) const
 Return ith smolyak coefficient.
 

Detailed Description

template<typename ordinal_type, typename value_type, typename coeff_compare_type = TotalOrderLess<MultiIndex<ordinal_type> >>
class Stokhos::SmolyakBasis< ordinal_type, value_type, coeff_compare_type >

Multivariate orthogonal polynomial basis generated from a Smolyak sparse grid.

Constructor & Destructor Documentation

◆ SmolyakBasis()

template<typename ordinal_type , typename value_type , typename coeff_compare_type = TotalOrderLess<MultiIndex<ordinal_type> >>
template<typename index_set_type >
Stokhos::SmolyakBasis< ordinal_type, value_type, coeff_compare_type >::SmolyakBasis ( const Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > &  bases,
const index_set_type &  index_set,
const value_type &  sparse_tol = 1.0e-12,
const coeff_compare_type &  coeff_compare = coeff_compare_type() 
)

Constructor.

Parameters
basesarray of 1-D coordinate bases
sparse_toltolerance used to drop terms in sparse triple-product tensors

Member Function Documentation

◆ computeLinearTripleProductTensor()

template<typename ordinal_type , typename value_type , typename ordering_type >
Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::computeLinearTripleProductTensor
virtual

Compute linear triple product tensor where k = 0,1,..,d.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

◆ computeTripleProductTensor()

template<typename ordinal_type , typename value_type , typename ordering_type >
Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::computeTripleProductTensor
virtual

Compute triple product tensor.

The $(i,j,k)$ entry of the tensor $C_{ijk}$ is given by $C_{ijk} = \langle\Psi_i\Psi_j\Psi_k\rangle$ where $\Psi_l$ represents basis polynomial $l$ and $i,j,k=0,\dots,P$ where $P$ is size()-1.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

◆ dimension()

template<typename ordinal_type , typename value_type , typename ordering_type >
ordinal_type Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::dimension
virtual

◆ evaluateBases()

template<typename ordinal_type , typename value_type , typename ordering_type >
void Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::evaluateBases ( const Teuchos::ArrayView< const value_type > &  point,
Teuchos::Array< value_type > &  basis_vals 
) const
virtual

Evaluate basis polynomials at given point point.

Size of returned array is given by size(), and coefficients are ordered from order 0 up to size size()-1.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

Referenced by Stokhos::SmolyakPseudoSpectralOperator< ordinal_t, value_t, point_compare_type >::SmolyakPseudoSpectralOperator().

◆ evaluateZero()

template<typename ordinal_type , typename value_type , typename ordering_type >
value_type Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::evaluateZero ( ordinal_type  i) const
virtual

Evaluate basis polynomial i at zero.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

◆ getCoordinateBases()

template<typename ordinal_type , typename value_type , typename ordering_type >
Teuchos::Array< Teuchos::RCP< const Stokhos::OneDOrthogPolyBasis< ordinal_type, value_type > > > Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::getCoordinateBases
virtual

◆ getMaxOrders()

template<typename ordinal_type , typename value_type , typename ordering_type >
Stokhos::MultiIndex< ordinal_type > Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::getMaxOrders
virtual

Return maximum order allowable for each coordinate basis.

Implements Stokhos::ProductBasis< ordinal_type, value_type >.

◆ getName()

template<typename ordinal_type , typename value_type , typename ordering_type >
const std::string & Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::getName
virtual

Return string name of basis.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

◆ index()

template<typename ordinal_type , typename value_type , typename ordering_type >
ordinal_type Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::index ( const MultiIndex< ordinal_type > &  term) const
virtual

Get index of the multivariate polynomial given orders of each coordinate.

Given the array term storing $i_1,\dots,\i_d$, returns the index $i$ such that $\Psi_i(x) = \psi_{i_1}(x_1)\dots\psi_{i_d}(x_d)$.

Implements Stokhos::ProductBasis< ordinal_type, value_type >.

Referenced by Stokhos::SmolyakPseudoSpectralOperator< ordinal_t, value_t, point_compare_type >::SmolyakPseudoSpectralOperator().

◆ norm_squared() [1/2]

template<typename ordinal_type , typename value_type , typename ordering_type >
const Teuchos::Array< value_type > & Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::norm_squared
virtual

Return array storing norm-squared of each basis polynomial.

Entry $l$ of returned array is given by $\langle\Psi_l^2\rangle$ for $l=0,\dots,P$ where $P$ is size()-1.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

Referenced by Stokhos::SmolyakPseudoSpectralOperator< ordinal_t, value_t, point_compare_type >::SmolyakPseudoSpectralOperator().

◆ norm_squared() [2/2]

template<typename ordinal_type , typename value_type , typename ordering_type >
const value_type & Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::norm_squared ( ordinal_type  i) const
virtual

Return norm squared of basis polynomial i.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

◆ order()

template<typename ordinal_type , typename value_type , typename ordering_type >
ordinal_type Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::order
virtual

Return order of basis.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

◆ print()

template<typename ordinal_type , typename value_type , typename ordering_type >
void Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::print ( std::ostream &  os) const
virtual

Print basis to stream os.

Implements Stokhos::OrthogPolyBasis< ordinal_type, value_type >.

◆ size()

template<typename ordinal_type , typename value_type , typename ordering_type >
ordinal_type Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::size
virtual

◆ term()

template<typename ordinal_type , typename value_type , typename ordering_type >
const Stokhos::MultiIndex< ordinal_type > & Stokhos::SmolyakBasis< ordinal_type, value_type, ordering_type >::term ( ordinal_type  i) const
virtual

Get orders of each coordinate polynomial given an index i.

The returned array is of size $d$, where $d$ is the dimension of the basis, and entry $l$ is given by $i_l$ where $\Psi_i(x) = \psi_{i_1}(x_1)\dots\psi_{i_d}(x_d)$.

Implements Stokhos::ProductBasis< ordinal_type, value_type >.


The documentation for this class was generated from the following files: