54     const unsigned int d = 2;
 
   55     const unsigned int pmin = 2;
 
   56     const unsigned int pmax = 10;
 
   57     const unsigned int np = pmax-pmin+1;
 
   58     bool use_pce_quad_points = 
false;
 
   59     bool normalize = 
true;
 
   60     bool sparse_grid = 
true;
 
   61 #ifndef HAVE_STOKHOS_DAKOTA 
   73     for (
unsigned int p=pmin; p<=pmax; p++) {
 
   75       std::cout << 
"p = " << p << std::endl;
 
   78       for (
unsigned int i=0; i<d; i++)
 
   86       for (
unsigned int i=0; i<d; i++) {
 
   90       double x_pt = x.evaluate(eval_pt);
 
   95 #ifdef HAVE_STOKHOS_DAKOTA 
   98     Teuchos::rcp(
new Stokhos::SparseGridQuadrature<int,double>(basis, p));
 
  106   basis->computeTripleProductTensor();
 
  121       st_bases[0] = st_1d_basis;
 
  129       u_st.term(0, 0) = st_1d_basis->getNewCoeffs(0);
 
  130       u_st.term(0, 1) = st_1d_basis->getNewCoeffs(1);
 
  134   st_basis->computeTripleProductTensor();
 
  138       if (!use_pce_quad_points) {
 
  139 #ifdef HAVE_STOKHOS_DAKOTA 
  141     st_quad = 
Teuchos::rcp(
new Stokhos::SparseGridQuadrature<int,double>(st_basis, p));
 
  150   st_bases[0]->getQuadPoints(p+1, st_points_0, st_weights_0, st_values_0);
 
  154   st_bases[1]->getQuadPoints(p+1, st_points_1, st_weights_1, st_values_1);
 
  157   for (
int i=0; i<st_points_0.
size(); i++) {
 
  158     (*st_points)[i].resize(2);
 
  159     (*st_points)[i][0] = st_points_0[i];
 
  160     (*st_points)[i][1] = st_points_1[i];
 
  178       st_quad_exp.
exp(w_st, u_st);
 
  189       mean_st[n] = w2.
mean();
 
  190       std_dev[n] = w.standard_deviation();
 
  192       pt[n] = w.evaluate(eval_pt);
 
  199     std::cout << 
"Statistical error:" << std::endl;
 
  201         << std::setw(wi) << 
"mean" << 
"  "  
  202         << std::setw(wi) << 
"mean_st" << 
"  " 
  203         << std::setw(wi) << 
"std_dev" << 
"  " 
  204         << std::setw(wi) << 
"std_dev_st" << 
"  " 
  205         << std::setw(wi) << 
"point" << 
"  " 
  206         << std::setw(wi) << 
"point_st" << std::endl;
 
  207     for (
unsigned int p=pmin; p<pmax; p++) {
 
  208       std::cout.precision(3);
 
  209       std::cout.setf(std::ios::scientific);
 
  210       std::cout << p << 
"  "  
  211     << std::setw(wi) << 
rel_err(mean[n], mean[np-1]) << 
"  " 
  212     << std::setw(wi) << 
rel_err(mean_st[n], mean[np-1]) << 
"  " 
  213     << std::setw(wi) << 
rel_err(std_dev[n], std_dev[np-1]) << 
"  " 
  214     << std::setw(wi) << 
rel_err(std_dev_st[n], std_dev[np-1]) 
 
  216     << std::setw(wi) << 
rel_err(pt[n], pt_true) << 
"  " 
  217     << std::setw(wi) << 
rel_err(pt_st[n], pt_true) 
 
  223   catch (std::exception& e) {
 
  224     std::cout << e.what() << std::endl;
 
void sin(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
value_type evaluate(const Teuchos::Array< value_type > &point) const 
Evaluate polynomial approximation at a point. 
void exp(OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
const Stokhos::OrthogPolyApprox< int, double > & pce
sin_func(const Stokhos::OrthogPolyApprox< int, double > &pce_)
pce_quad_func(const Stokhos::OrthogPolyApprox< int, double > &pce_, const Stokhos::OrthogPolyBasis< int, double > &basis_)
Teuchos::Array< double > vec
Stokhos::LegendreBasis< int, double > basis_type
value_type standard_deviation() const 
Compute standard deviation of expansion. 
double operator()(const Teuchos::Array< double > &x) const 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const Stokhos::OrthogPolyBasis< int, double > & basis
double operator()(const double &a, const double &b) const 
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
const Stokhos::OrthogPolyApprox< int, double > & pce
value_type mean() const 
Compute mean of expansion. 
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
int main(int argc, char **argv)
Legendre polynomial basis using Clenshaw-Curtis quadrature points. 
double rel_err(double a, double b)
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
Generates three-term recurrence using the Lanczos procedure applied to a polynomial chaos expansion i...
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...
void unary_op(const FuncT &func, OrthogPolyApprox< ordinal_type, value_type, node_type > &c, const OrthogPolyApprox< ordinal_type, value_type, node_type > &a)
Nonlinear unary function.