75 Array< RCP<const Stokhos::OneDOrthogPolyBasis<int,double> > > bases(d);
76 for (
int i=0; i<d; i++) {
79 RCP<const Stokhos::CompletePolynomialBasis<int,double> > basis =
83 RCP<const Stokhos::Quadrature<int,double> > quad =
87 RCP<Stokhos::Sparse3Tensor<int,double> > Cijk =
88 basis->computeTripleProductTensor();
96 for (
int i=0; i<d; i++) {
97 if (bases[i]->order() >= 1)
98 u.term(i,1) = 0.4 / d;
99 if (bases[i]->order() >= 2)
100 u.term(i,2) = 0.06 / d;
101 if (bases[i]->order() >= 3)
102 u.term(i,3) = 0.002 / d;
112 std::cout <<
"v = 1.0 / (log(u)^2 + 1):" << std::endl;
113 std::cout <<
"\tu = ";
115 std::cout <<
"\tv = ";
119 double mean = v.mean();
120 double std_dev = v.standard_deviation();
124 for (
int i=0; i<d; i++)
126 double up = u.evaluate(pt);
128 double vp2 = v.evaluate(pt);
131 std::cout <<
"\tv mean = " << mean << std::endl;
132 std::cout <<
"\tv std. dev. = " << std_dev << std::endl;
133 std::cout <<
"\tv(0.25) (true) = " << vp << std::endl;
134 std::cout <<
"\tv(0.25) (pce) = " << vp2 << std::endl;
138 std::cout <<
"\nExample Passed!" << std::endl;
142 catch (std::exception& e) {
143 std::cout << e.what() << std::endl;
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)
Hermite polynomial basis.
void plusEqual(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const value_type &x)
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)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
static void summarize(Ptr< const Comm< int > > comm, std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true, const ECounterSetOp setOp=Intersection, const std::string &filter="", const bool ignoreZeroTimers=false)
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
void log(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
int main(int argc, char **argv)
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...