41 Array< RCP<const Stokhos::OneDOrthogPolyBasis<int,double> > > bases(d);
42 for (
int i=0; i<d; i++) {
45 RCP<const Stokhos::CompletePolynomialBasis<int,double> > basis =
49 RCP<const Stokhos::Quadrature<int,double> > quad =
53 RCP<Stokhos::Sparse3Tensor<int,double> > Cijk =
54 basis->computeTripleProductTensor();
62 for (
int i=0; i<d; i++) {
63 if (bases[i]->order() >= 1)
64 u.term(i,1) = 0.4 / d;
65 if (bases[i]->order() >= 2)
66 u.term(i,2) = 0.06 / d;
67 if (bases[i]->order() >= 3)
68 u.term(i,3) = 0.002 / d;
78 std::cout <<
"v = 1.0 / (log(u)^2 + 1):" << std::endl;
79 std::cout <<
"\tu = ";
81 std::cout <<
"\tv = ";
85 double mean = v.mean();
86 double std_dev = v.standard_deviation();
90 for (
int i=0; i<d; i++)
92 double up = u.evaluate(pt);
94 double vp2 = v.evaluate(pt);
97 std::cout <<
"\tv mean = " << mean << std::endl;
98 std::cout <<
"\tv std. dev. = " << std_dev << std::endl;
99 std::cout <<
"\tv(0.25) (true) = " << vp << std::endl;
100 std::cout <<
"\tv(0.25) (pce) = " << vp2 << std::endl;
104 std::cout <<
"\nExample Passed!" << std::endl;
108 catch (std::exception& e) {
109 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...