Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type > Class Template Reference

Class to store coefficients of a projection onto an orthogonal polynomial basis. More...

#include <Stokhos_OrthogPolyApprox.hpp>

Inheritance diagram for Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >:
Inheritance graph
[legend]

Public Types

typedef storage_type::reference reference
 
typedef storage_type::const_reference const_reference
 
typedef storage_type::pointer pointer
 
typedef storage_type::const_pointer const_pointer
 

Public Member Functions

 OrthogPolyApprox (const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > &basis=Teuchos::null, ordinal_type sz=0, const value_type *vals=NULL)
 Constructor with supplied size sz.
 
 OrthogPolyApprox (const OrthogPolyApprox &x)
 Copy constructor.
 
 ~OrthogPolyApprox ()
 Destructor.
 
OrthogPolyApproxoperator= (const OrthogPolyApprox &x)
 Assignment operator (deep copy)
 
OrthogPolyApproxoperator= (const value_type &v)
 Assignment operator with scalar.
 
void init (const value_type &v)
 Initialize coefficients to value.
 
void init (const value_type *v)
 Initialize coefficients to an array of values.
 
template<typename S >
void init (const OrthogPolyApprox< ordinal_type, value_type, S > &v)
 Initialize coefficients from an OrthogPolyApprox with different storage.
 
void load (value_type *v)
 Load coefficients to an array of values.
 
template<typename S >
void load (OrthogPolyApprox< ordinal_type, value_type, S > &v)
 Load coefficients into an OrthogPolyApprox with different storage.
 
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis () const
 Return basis.
 
void reset (const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > &new_basis, ordinal_type sz=0)
 Reset to a new basis.
 
void resize (ordinal_type sz)
 Resize coefficient array (coefficients are preserved)
 
ordinal_type size () const
 Return size.
 
pointer coeff ()
 Return coefficient array.
 
const_pointer coeff () const
 Return coefficient array.
 
reference operator[] (ordinal_type i)
 Array access.
 
const_reference operator[] (ordinal_type i) const
 Array access.
 
reference term (ordinal_type dimension, ordinal_type order)
 Get coefficient term for given dimension and order.
 
const_reference term (ordinal_type dimension, ordinal_type order) const
 Get coefficient term for given dimension and order.
 
const MultiIndex< ordinal_type > & order (ordinal_type term) const
 Get orders for a given term.
 
value_type evaluate (const Teuchos::Array< value_type > &point) const
 Evaluate polynomial approximation at a point.
 
value_type evaluate (const Teuchos::Array< value_type > &point, const Teuchos::Array< value_type > &basis_vals) const
 Evaluate polynomial approximation at a point with supplied basis values.
 
value_type mean () const
 Compute mean of expansion.
 
value_type standard_deviation () const
 Compute standard deviation of expansion.
 
value_type two_norm () const
 Compute the two-norm of expansion.
 
value_type two_norm_squared () const
 Compute the squared two-norm of expansion.
 
value_type inner_product (const OrthogPolyApprox &b) const
 Compute the L2 inner product of 2 PCEs.
 
std::ostream & print (std::ostream &os) const
 Print approximation in basis.
 

Protected Attributes

Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis_
 Basis expansion is relative to.
 
storage_type coeff_
 OrthogPolyApprox coefficients.
 

Detailed Description

template<typename ordinal_type, typename value_type, typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
class Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >

Class to store coefficients of a projection onto an orthogonal polynomial basis.

Definition at line 63 of file Stokhos_OrthogPolyApprox.hpp.

Member Typedef Documentation

◆ reference

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
typedef storage_type::reference Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::reference

Definition at line 66 of file Stokhos_OrthogPolyApprox.hpp.

◆ const_reference

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
typedef storage_type::const_reference Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::const_reference

Definition at line 67 of file Stokhos_OrthogPolyApprox.hpp.

◆ pointer

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
typedef storage_type::pointer Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::pointer

Definition at line 68 of file Stokhos_OrthogPolyApprox.hpp.

◆ const_pointer

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
typedef storage_type::const_pointer Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::const_pointer

Definition at line 69 of file Stokhos_OrthogPolyApprox.hpp.

Constructor & Destructor Documentation

◆ OrthogPolyApprox() [1/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::OrthogPolyApprox ( const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > & basis = Teuchos::null,
ordinal_type sz = 0,
const value_type * vals = NULL )

Constructor with supplied size sz.

Normally sz should equal the basis size, however this is not enforced since other situations can arise, e.g., using a size of 1 for a constant expansion. If sz = 0, it is computed from the basis size (and is 1 if basis is null).

Definition at line 47 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ OrthogPolyApprox() [2/2]

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::OrthogPolyApprox ( const OrthogPolyApprox< ordinal_type, value_type, storage_type > & x)

Copy constructor.

◆ ~OrthogPolyApprox()

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::~OrthogPolyApprox ( )

Destructor.

Definition at line 74 of file Stokhos_OrthogPolyApproxImp.hpp.

Member Function Documentation

◆ operator=() [1/2]

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
OrthogPolyApprox & Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::operator= ( const OrthogPolyApprox< ordinal_type, value_type, storage_type > & x)

Assignment operator (deep copy)

◆ operator=() [2/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type > & Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::operator= ( const value_type & v)

Assignment operator with scalar.

Definition at line 94 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ init() [1/3]

template<typename ordinal_type , typename value_type , typename storage_type >
void Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::init ( const value_type & v)

Initialize coefficients to value.

Definition at line 105 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ init() [2/3]

template<typename ordinal_type , typename value_type , typename storage_type >
void Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::init ( const value_type * v)

Initialize coefficients to an array of values.

Definition at line 113 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ init() [3/3]

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
template<typename S >
void Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::init ( const OrthogPolyApprox< ordinal_type, value_type, S > & v)
inline

Initialize coefficients from an OrthogPolyApprox with different storage.

Definition at line 103 of file Stokhos_OrthogPolyApprox.hpp.

◆ load() [1/2]

template<typename ordinal_type , typename value_type , typename storage_type >
void Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::load ( value_type * v)

Load coefficients to an array of values.

Definition at line 121 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ load() [2/2]

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
template<typename S >
void Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::load ( OrthogPolyApprox< ordinal_type, value_type, S > & v)
inline

Load coefficients into an OrthogPolyApprox with different storage.

Definition at line 112 of file Stokhos_OrthogPolyApprox.hpp.

◆ basis()

template<typename ordinal_type , typename value_type , typename storage_type >
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::basis ( ) const

Return basis.

Definition at line 129 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ reset()

template<typename ordinal_type , typename value_type , typename storage_type >
void Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::reset ( const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > & new_basis,
ordinal_type sz = 0 )

Reset to a new basis.

This resizes array to fit new basis. Coefficients are preserved.

Definition at line 137 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ resize()

template<typename ordinal_type , typename value_type , typename storage_type >
void Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::resize ( ordinal_type sz)

Resize coefficient array (coefficients are preserved)

Definition at line 151 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ size()

template<typename ordinal_type , typename value_type , typename storage_type >
ordinal_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::size ( ) const

Return size.

Definition at line 159 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ coeff() [1/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::pointer Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::coeff ( )

Return coefficient array.

Definition at line 167 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ coeff() [2/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::const_pointer Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::coeff ( ) const

Return coefficient array.

Definition at line 180 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ operator[]() [1/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::reference Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::operator[] ( ordinal_type i)

Array access.

Definition at line 193 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ operator[]() [2/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::const_reference Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::operator[] ( ordinal_type i) const

Array access.

Definition at line 201 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ term() [1/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::reference Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::term ( ordinal_type dimension,
ordinal_type order )

Get coefficient term for given dimension and order.

Definition at line 209 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ term() [2/2]

template<typename ordinal_type , typename value_type , typename storage_type >
Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::const_reference Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::term ( ordinal_type dimension,
ordinal_type order ) const

Get coefficient term for given dimension and order.

Definition at line 223 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ order()

template<typename ordinal_type , typename value_type , typename storage_type >
const Stokhos::MultiIndex< ordinal_type > & Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::order ( ordinal_type term) const

Get orders for a given term.

Definition at line 237 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ evaluate() [1/2]

template<typename ordinal_type , typename value_type , typename storage_type >
value_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::evaluate ( const Teuchos::Array< value_type > & point) const

Evaluate polynomial approximation at a point.

Definition at line 247 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ evaluate() [2/2]

template<typename ordinal_type , typename value_type , typename storage_type >
value_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::evaluate ( const Teuchos::Array< value_type > & point,
const Teuchos::Array< value_type > & basis_vals ) const

Evaluate polynomial approximation at a point with supplied basis values.

Definition at line 257 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ mean()

template<typename ordinal_type , typename value_type , typename storage_type >
value_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::mean ( ) const

Compute mean of expansion.

Definition at line 270 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ standard_deviation()

template<typename ordinal_type , typename value_type , typename storage_type >
value_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::standard_deviation ( ) const

Compute standard deviation of expansion.

Definition at line 278 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ two_norm()

template<typename ordinal_type , typename value_type , typename storage_type >
value_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::two_norm ( ) const

Compute the two-norm of expansion.

Definition at line 291 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ two_norm_squared()

template<typename ordinal_type , typename value_type , typename storage_type >
value_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::two_norm_squared ( ) const

Compute the squared two-norm of expansion.

Definition at line 299 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ inner_product()

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
value_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::inner_product ( const OrthogPolyApprox< ordinal_type, value_type, storage_type > & b) const

Compute the L2 inner product of 2 PCEs.

Definition at line 318 of file Stokhos_OrthogPolyApproxImp.hpp.

◆ print()

template<typename ordinal_type , typename value_type , typename storage_type >
std::ostream & Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::print ( std::ostream & os) const

Print approximation in basis.

Definition at line 345 of file Stokhos_OrthogPolyApproxImp.hpp.

Member Data Documentation

◆ basis_

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
Teuchos::RCP<const Stokhos::OrthogPolyBasis<ordinal_type, value_type> > Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::basis_
protected

Basis expansion is relative to.

Definition at line 181 of file Stokhos_OrthogPolyApprox.hpp.

◆ coeff_

template<typename ordinal_type , typename value_type , typename storage_type = Stokhos::StandardStorage<ordinal_type, value_type>>
storage_type Stokhos::OrthogPolyApprox< ordinal_type, value_type, storage_type >::coeff_
protected

OrthogPolyApprox coefficients.

Definition at line 184 of file Stokhos_OrthogPolyApprox.hpp.


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