27 template <
class ScalarType>
30 return 1.0/(z*z + 1.0);
56 Array< RCP<const OneDOrthogPolyBasis<int,double> > > bases(d);
57 for (
int i=0; i<d; i++) {
58 bases[i] =
rcp(
new HermiteBasis<int,double>(p));
60 RCP<const CompletePolynomialBasis<int,double> > basis =
61 rcp(
new CompletePolynomialBasis<int,double>(bases));
64 RCP<const Quadrature<int,double> > quad =
65 rcp(
new TensorProductQuadrature<int,double>(basis));
68 RCP<Sparse3Tensor<int,double> > Cijk =
69 basis->computeTripleProductTensor();
72 RCP<QuadOrthogPolyExpansion<int,double> > expn =
73 rcp(
new QuadOrthogPolyExpansion<int,double>(basis, Cijk, quad));
86 std::cout <<
"\tu = ";
88 std::cout <<
"\tv = ";
92 double mean = v.mean();
93 double std_dev = v.standard_deviation();
97 for (
int i=0; i<d; i++)
99 double up = u.evaluate(pt);
101 double vp2 = v.evaluate(pt);
104 std::cout <<
"\tv mean = " << mean << std::endl;
105 std::cout <<
"\tv std. dev. = " << std_dev << std::endl;
106 std::cout <<
"\tv(0.25) (true) = " << vp << std::endl;
107 std::cout <<
"\tv(0.25) (pce) = " << vp2 << std::endl;
109 catch (std::exception& e) {
110 std::cout << e.what() << std::endl;
ScalarType simple_function(const ScalarType &u)
Stokhos::StandardStorage< int, double > storage_type
Hermite polynomial basis.
Sacado::ETPCE::OrthogPoly< double, Stokhos::StandardStorage< int, double > > pce_type
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Abstract base class for quadrature methods.
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
int main(int argc, char **argv)
Abstract base class for 1-D orthogonal polynomials.
Orthogonal polynomial expansions based on numerical quadrature.
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...