31 const unsigned int true_quad_order = 200;
36 true_quad_weights, true_quad_values);
39 for (
unsigned int qp=0; qp<true_quad_points.
size(); qp++) {
40 double t =
std::exp(true_quad_points[qp]);
41 mean_1d += t*true_quad_weights[qp];
42 sd_1d += t*t*true_quad_weights[qp];
45 const unsigned int dmin = 1;
46 const unsigned int dmax = 4;
47 const unsigned int pmin = 1;
48 const unsigned int pmax = 5;
51 for (
unsigned int d=dmin; d<=dmax; d++) {
54 double true_mean =
std::pow(mean_1d,static_cast<double>(d));
55 double true_sd =
std::pow(sd_1d,static_cast<double>(d)) -
58 std::cout.precision(12);
59 std::cout <<
"true mean = " << true_mean <<
"\t true std. dev. = "
60 << true_sd << std::endl;
65 for (
unsigned int p=pmin; p<=pmax; p++) {
68 for (
unsigned int i=0; i<d; i++)
74 int sz = basis->size();
76 for (
unsigned int i=0; i<d; i++) {
86 basis->computeTripleProductTensor();
94 double mean = u.
mean();
97 std::cout.precision(4);
98 std::cout.setf(std::ios::scientific);
99 std::cout <<
"d = " << d <<
" p = " << p
102 <<
std::fabs(true_mean-mean) <<
"\tstd. dev. err = "
108 catch (std::exception& e) {
109 std::cout << e.what() << std::endl;
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > fabs(const PCE< Storage > &a)
void exp(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
virtual void getQuadPoints(ordinal_type quad_order, Teuchos::Array< value_type > &points, Teuchos::Array< value_type > &weights, Teuchos::Array< Teuchos::Array< value_type > > &values) const
Compute quadrature points, weights, and values of basis polynomials at given set of points points...
Stokhos::LegendreBasis< int, double > basis_type
value_type standard_deviation() const
Compute standard deviation of expansion.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
value_type mean() const
Compute mean of expansion.
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
Legendre polynomial basis.
int main(int argc, char **argv)
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...