Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_OrthogPolyApprox.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef STOKHOS_ORTHOGPOLYAPPROX_HPP
11 #define STOKHOS_ORTHOGPOLYAPPROX_HPP
12 
13 #include "Teuchos_RCP.hpp" // class data member
14 #include "Stokhos_OrthogPolyBasis.hpp" // class data member
15 #include <ostream> // for std::ostream
16 
19 
20 namespace Stokhos {
21 
26  template <typename ordinal_type, typename value_type,
28  value_type> >
30  public:
31 
34  typedef typename storage_type::pointer pointer;
36 
38 
46  ordinal_type sz = 0,
47  const value_type* vals = NULL);
48 
51 
54 
57 
60 
62  void init(const value_type& v);
63 
65  void init(const value_type* v);
66 
68  template <typename S>
70  coeff_.init(v.coeff());
71  }
72 
74  void load(value_type* v);
75 
77  template <typename S>
79  coeff_.load(v.coeff());
80  }
81 
84  basis() const;
85 
87 
91 
93  void resize(ordinal_type sz);
94 
96  ordinal_type size() const;
97 
99  pointer coeff();
100 
102  const_pointer coeff() const;
103 
106 
109 
112 
115 
118 
120  value_type evaluate(const Teuchos::Array<value_type>& point) const;
121 
124  const Teuchos::Array<value_type>& basis_vals) const;
125 
127  value_type mean() const;
128 
131 
133  value_type two_norm() const;
134 
137 
139  value_type inner_product(const OrthogPolyApprox& b) const;
140 
142  std::ostream& print(std::ostream& os) const;
143 
144  protected:
145 
148 
151 
152  }; // class OrthogPolyApprox
153 
155  template <typename ordinal_type, typename value_type, typename node_type>
156  std::ostream&
157  operator << (std::ostream& os,
159 
160 } // namespace Stokhos
161 
163 
164 #endif // STOKHOS_ORTHOGPOLYAPPROX_HPP
value_type two_norm_squared() const
Compute the squared two-norm of expansion.
void resize(ordinal_type sz)
Resize coefficient array (coefficients are preserved)
value_type evaluate(const Teuchos::Array< value_type > &point) const
Evaluate polynomial approximation at a point.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis_
Basis expansion is relative to.
OrthogPolyApprox & operator=(const OrthogPolyApprox &x)
Assignment operator (deep copy)
void init(const value_type &v)
Initialize coefficients to value.
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.
pointer coeff()
Return coefficient array.
value_type two_norm() const
Compute the two-norm of expansion.
value_type inner_product(const OrthogPolyApprox &b) const
Compute the L2 inner product of 2 PCEs.
value_type standard_deviation() const
Compute standard deviation of expansion.
Abstract base class for multivariate orthogonal polynomials.
reference operator[](ordinal_type i)
Array access.
storage_type::reference reference
void load(OrthogPolyApprox< ordinal_type, value_type, S > &v)
Load coefficients into an OrthogPolyApprox with different storage.
std::ostream & operator<<(std::ostream &os, const ProductContainer< coeff_type > &vec)
storage_type coeff_
OrthogPolyApprox coefficients.
void reset(const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > &new_basis, ordinal_type sz=0)
Reset to a new basis.
void init(const OrthogPolyApprox< ordinal_type, value_type, S > &v)
Initialize coefficients from an OrthogPolyApprox with different storage.
void load(pointer v)
Load values to an array of values.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis() const
Return basis.
void load(value_type *v)
Load coefficients to an array of values.
value_type mean() const
Compute mean of expansion.
storage_type::const_reference const_reference
storage_type::const_pointer const_pointer
Class to store coefficients of a projection onto an orthogonal polynomial basis.
void init(const_reference v)
Initialize values to a constant value.
std::ostream & print(std::ostream &os) const
Print approximation in basis.
ordinal_type size() const
Return size.
const MultiIndex< ordinal_type > & order(ordinal_type term) const
Get orders for a given term.
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.