61#include "HermiteOrthogPolynomial.hpp"
70 Teuchos::Array< Teuchos::RCP<const Stokhos::OneDOrthogPolyBasis<int,double> > > bases(d);
71 for (
int i=0; i<d; i++) {
72 bases[i] = Teuchos::rcp(
new Stokhos::PecosOneDOrthogPolyBasis<int,double>(Teuchos::rcp(
new Pecos::HermiteOrthogPolynomial),
"Hermite", p));
74 Teuchos::RCP<const Stokhos::CompletePolynomialBasis<int,double> > basis =
78 Teuchos::RCP<const Stokhos::Quadrature<int,double> > quad =
82 Teuchos::RCP<Stokhos::Sparse3Tensor<int,double> > Cijk =
83 basis->computeTripleProductTensor();
91 for (
int i=0; i<d; i++) {
92 u.term(i,1) = 0.4 / d;
93 u.term(i,2) = 0.06 / d;
94 u.term(i,3) = 0.002 / d;
105 std::cout <<
"v = 1.0 / (log(u)^2 + 1):" << std::endl;
106 std::cout <<
"\tu = ";
108 std::cout <<
"\tv = ";
112 double mean = v.mean();
113 double std_dev = v.standard_deviation();
116 Teuchos::Array<double> pt(d);
117 for (
int i=0; i<d; i++)
119 double up = u.evaluate(pt);
120 double vp = 1.0/(std::log(up)*std::log(up)+1.0);
121 double vp2 = v.evaluate(pt);
124 std::cout <<
"\tv mean = " << mean << std::endl;
125 std::cout <<
"\tv std. dev. = " << std_dev << std::endl;
126 std::cout <<
"\tv(0.25) (true) = " << vp << std::endl;
127 std::cout <<
"\tv(0.25) (pce) = " << vp2 << std::endl;
130 if (std::abs(vp - vp2) < 1e-2)
131 std::cout <<
"\nExample Passed!" << std::endl;
133 catch (std::exception& e) {
134 std::cout << e.what() << std::endl;
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
Class to store coefficients of a projection onto an orthogonal polynomial basis.
void plusEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
Orthogonal polynomial expansions based on numerical quadrature.
void times(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
void divide(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a, const OrthogPolyApprox< ordinal_type, value_type, node_type > &b)
void log(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules.
int main(int argc, char **argv)