Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_QuadExpansionUnitTest.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
14 
15 #include "Stokhos.hpp"
17 
18 namespace QuadExpansionUnitTest {
19 
20  // Common setup for unit tests
21  template <typename OrdinalType, typename ValueType>
22  struct UnitTestSetup {
23  ValueType rtol, atol;
24  ValueType crtol, catol;
25  OrdinalType sz;
31  ValueType a;
32 
34  rtol = 1e-4;
35  atol = 1e-5;
36  crtol = 1e-12;
37  catol = 1e-12;
38  a = 3.1;
39  const OrdinalType d = 2;
40  const OrdinalType p = 7;
41 
42  // Create product basis
44  for (OrdinalType i=0; i<d; i++)
45  bases[i] =
47  basis =
49 
50  // Tensor product quadrature
51  quad =
53 
54  // Triple product tensor
57 
58  // Quadrature expansion
59  exp =
61  exp_linear =
63 
64  // Create approximation
65  sz = basis->size();
66  x.reset(basis);
67  y.reset(basis);
68  u.reset(basis);
69  u2.reset(basis);
70  cx.reset(basis, 1);
71  x.term(0, 0) = 1.0;
72  cx.term(0, 0) = a;
73  cu.reset(basis);
74  cu2.reset(basis, 1);
75  sx.reset(basis, d+1);
76  su.reset(basis, d+1);
77  su2.reset(basis, d+1);
78  for (OrdinalType i=0; i<d; i++) {
79  x.term(i, 1) = 0.1;
80  sx.term(i, 1) = 0.0;
81  }
82  y.term(0, 0) = 2.0;
83  for (OrdinalType i=0; i<d; i++)
84  y.term(i, 1) = 0.25;
85  }
86 
87  template <class Func>
90  {
91  // Quadrature data
92  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
97  OrdinalType nqp = weights.size();
98 
99  // Initialize
100  for (OrdinalType i=0; i<c.size(); i++)
101  c[i] = 0.0;
102 
103  // Compute PCE via quadrature
104  Func func;
105  for (OrdinalType k=0; k<nqp; k++) {
106  ValueType val = a.evaluate(points[k], values[k]);
107  val = func(val);
108  for (int i=0; i<c.size(); i++)
109  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
110  }
111  }
112 
113  template <class Func>
117  {
118  // Quadrature data
119  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
121  quad->getQuadPoints();
124  OrdinalType nqp = weights.size();
125 
126  // Initialize
127  for (OrdinalType i=0; i<c.size(); i++)
128  c[i] = 0.0;
129 
130  // Compute PCE via quadrature
131  Func func;
132  for (OrdinalType k=0; k<nqp; k++) {
133  ValueType val1 = a.evaluate(points[k], values[k]);
134  ValueType val2 = b.evaluate(points[k], values[k]);
135  ValueType val = func(val1, val2);
136  for (int i=0; i<c.size(); i++)
137  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
138  }
139  }
140 
141  template <class Func>
144  ValueType a,
146  {
147  // Quadrature data
148  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
150  quad->getQuadPoints();
153  OrdinalType nqp = weights.size();
154 
155  // Initialize
156  for (OrdinalType i=0; i<c.size(); i++)
157  c[i] = 0.0;
158 
159  // Compute PCE via quadrature
160  Func func;
161  for (OrdinalType k=0; k<nqp; k++) {
162  ValueType val2 = b.evaluate(points[k], values[k]);
163  ValueType val = func(a, val2);
164  for (int i=0; i<c.size(); i++)
165  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
166  }
167  }
168 
169  template <class Func>
173  ValueType b)
174  {
175  // Quadrature data
176  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
178  quad->getQuadPoints();
181  OrdinalType nqp = weights.size();
182 
183  // Initialize
184  for (OrdinalType i=0; i<c.size(); i++)
185  c[i] = 0.0;
186 
187  // Compute PCE via quadrature
188  Func func;
189  for (OrdinalType k=0; k<nqp; k++) {
190  ValueType val1 = a.evaluate(points[k], values[k]);
191  ValueType val = func(val1, b);
192  for (int i=0; i<c.size(); i++)
193  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
194  }
195  }
196 
197  };
198 
200 
201  struct UMinusFunc {
202  double operator() (double a) const { return -a; }
203  };
204  struct ExpFunc {
205  double operator() (double a) const { return std::exp(a); }
206  };
207  struct LogFunc {
208  double operator() (double a) const { return std::log(a); }
209  };
210  struct Log10Func {
211  double operator() (double a) const { return std::log10(a); }
212  };
213  struct SqrtFunc {
214  double operator() (double a) const { return std::sqrt(a); }
215  };
216  struct CbrtFunc {
217  double operator() (double a) const { return std::cbrt(a); }
218  };
219  struct SinFunc {
220  double operator() (double a) const { return std::sin(a); }
221  };
222  struct CosFunc {
223  double operator() (double a) const { return std::cos(a); }
224  };
225  struct TanFunc {
226  double operator() (double a) const { return std::tan(a); }
227  };
228  struct SinhFunc {
229  double operator() (double a) const { return std::sinh(a); }
230  };
231  struct CoshFunc {
232  double operator() (double a) const { return std::cosh(a); }
233  };
234  struct TanhFunc {
235  double operator() (double a) const { return std::tanh(a); }
236  };
237  struct ASinFunc {
238  double operator() (double a) const { return std::asin(a); }
239  };
240  struct ACosFunc {
241  double operator() (double a) const { return std::acos(a); }
242  };
243  struct ATanFunc {
244  double operator() (double a) const { return std::atan(a); }
245  };
246  struct ASinhFunc {
247  double operator() (double a) const {
248  return std::log(a+std::sqrt(a*a+1.0));
249  }
250  };
251  struct ACoshFunc {
252  double operator() (double a) const {
253  return std::log(a+std::sqrt(a*a-1.0));
254  }
255  };
256  struct ATanhFunc {
257  double operator() (double a) const {
258  return 0.5*std::log((1.0+a)/(1.0-a));
259  }
260  };
261 
262  struct PlusFunc {
263  double operator() (double a, double b) const { return a + b; }
264  };
265  struct MinusFunc {
266  double operator() (double a, double b) const { return a - b; }
267  };
268  struct TimesFunc {
269  double operator() (double a, double b) const { return a * b; }
270  };
271  struct DivideFunc {
272  double operator() (double a, double b) const { return a / b; }
273  };
274  struct PowFunc {
275  double operator() (double a, double b) const { return std::pow(a,b); }
276  };
277 
278  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, UMinus ) {
280  setup.exp->sin(v, setup.x);
281  setup.exp->unaryMinus(setup.u, v);
282  setup.computePCE1<UMinusFunc>(setup.u2, v);
283  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
284  setup.rtol, setup.atol, out);
285  }
286  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Exp ) {
287  setup.exp->exp(setup.u, setup.x);
288  setup.computePCE1<ExpFunc>(setup.u2, setup.x);
289  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
290  setup.rtol, setup.atol, out);
291  }
292  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ExpConst ) {
293  setup.exp->exp(setup.cu, setup.cx);
294  setup.cu2[0] = std::exp(setup.cx[0]);
295  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
296  setup.crtol, setup.catol, out);
297  }
298  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ExpResize ) {
300  setup.exp->exp(ru, setup.x);
301  setup.computePCE1<ExpFunc>(setup.u2, setup.x);
302  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
303  setup.rtol, setup.atol, out);
304  }
305  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Log ) {
306  setup.exp->log(setup.u, setup.x);
307  setup.computePCE1<LogFunc>(setup.u2, setup.x);
308  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
309  setup.rtol, setup.atol, out);
310  }
311  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, LogConst ) {
312  setup.exp->log(setup.cu, setup.cx);
313  setup.cu2[0] = std::log(setup.cx[0]);
314  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
315  setup.crtol, setup.catol, out);
316  }
317  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, LogResize ) {
319  setup.exp->log(ru, setup.x);
320  setup.computePCE1<LogFunc>(setup.u2, setup.x);
321  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
322  setup.rtol, setup.atol, out);
323  }
324  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Log10 ) {
325  setup.exp->log10(setup.u, setup.x);
326  setup.computePCE1<Log10Func>(setup.u2, setup.x);
327  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
328  setup.rtol, setup.atol, out);
329  }
330  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Log10Const ) {
331  setup.exp->log10(setup.cu, setup.cx);
332  setup.cu2[0] = std::log10(setup.cx[0]);
333  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
334  setup.crtol, setup.catol, out);
335  }
336  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Log10Resize ) {
338  setup.exp->log10(ru, setup.x);
339  setup.computePCE1<Log10Func>(setup.u2, setup.x);
340  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
341  setup.rtol, setup.atol, out);
342  }
343  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Sqrt ) {
344  setup.exp->sqrt(setup.u, setup.x);
345  setup.computePCE1<SqrtFunc>(setup.u2, setup.x);
346  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
347  setup.rtol, setup.atol, out);
348  }
349  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, SqrtConst ) {
350  setup.exp->sqrt(setup.cu, setup.cx);
351  setup.cu2[0] = std::sqrt(setup.cx[0]);
352  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
353  setup.crtol, setup.catol, out);
354  }
355  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, SqrtResize ) {
357  setup.exp->sqrt(ru, setup.x);
358  setup.computePCE1<SqrtFunc>(setup.u2, setup.x);
359  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
360  setup.rtol, setup.atol, out);
361  }
362  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Cbrt ) {
363  setup.exp->cbrt(setup.u, setup.x);
364  setup.computePCE1<CbrtFunc>(setup.u2, setup.x);
365  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
366  setup.rtol, setup.atol, out);
367  }
368  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, CbrtConst ) {
369  setup.exp->cbrt(setup.cu, setup.cx);
370  setup.cu2[0] = std::cbrt(setup.cx[0]);
371  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
372  setup.crtol, setup.catol, out);
373  }
374  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, CbrtResize ) {
376  setup.exp->cbrt(ru, setup.x);
377  setup.computePCE1<CbrtFunc>(setup.u2, setup.x);
378  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
379  setup.rtol, setup.atol, out);
380  }
381  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Sin ) {
382  setup.exp->sin(setup.u, setup.x);
383  setup.computePCE1<SinFunc>(setup.u2, setup.x);
384  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
385  setup.rtol, setup.atol, out);
386  }
387  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, SinConst ) {
388  setup.exp->sin(setup.cu, setup.cx);
389  setup.cu2[0] = std::sin(setup.cx[0]);
390  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
391  setup.crtol, setup.catol, out);
392  }
393  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, SinResize ) {
395  setup.exp->sin(ru, setup.x);
396  setup.computePCE1<SinFunc>(setup.u2, setup.x);
397  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
398  setup.rtol, setup.atol, out);
399  }
400  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Cos ) {
401  setup.exp->cos(setup.u, setup.x);
402  setup.computePCE1<CosFunc>(setup.u2, setup.x);
403  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
404  setup.rtol, setup.atol, out);
405  }
406  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, CosConst ) {
407  setup.exp->cos(setup.cu, setup.cx);
408  setup.cu2[0] = std::cos(setup.cx[0]);
409  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
410  setup.crtol, setup.catol, out);
411  }
412  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, CosResize ) {
414  setup.exp->cos(ru, setup.x);
415  setup.computePCE1<CosFunc>(setup.u2, setup.x);
416  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
417  setup.rtol, setup.atol, out);
418  }
419  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Tan ) {
420  setup.exp->tan(setup.u, setup.x);
421  setup.computePCE1<TanFunc>(setup.u2, setup.x);
422  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
423  setup.rtol, setup.atol, out);
424  }
425  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TanConst ) {
426  setup.exp->tan(setup.cu, setup.cx);
427  setup.cu2[0] = std::tan(setup.cx[0]);
428  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
429  setup.crtol, setup.catol, out);
430  }
431  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TanResize ) {
433  setup.exp->tan(ru, setup.x);
434  setup.computePCE1<TanFunc>(setup.u2, setup.x);
435  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
436  setup.rtol, setup.atol, out);
437  }
438  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Sinh ) {
439  setup.exp->sinh(setup.u, setup.x);
440  setup.computePCE1<SinhFunc>(setup.u2, setup.x);
441  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
442  setup.rtol, setup.atol, out);
443  }
444  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, SinhConst ) {
445  setup.exp->sinh(setup.cu, setup.cx);
446  setup.cu2[0] = std::sinh(setup.cx[0]);
447  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
448  setup.crtol, setup.catol, out);
449  }
450  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, SinhResize ) {
452  setup.exp->sinh(ru, setup.x);
453  setup.computePCE1<SinhFunc>(setup.u2, setup.x);
454  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
455  setup.rtol, setup.atol, out);
456  }
457  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Cosh ) {
458  setup.exp->cosh(setup.u, setup.x);
459  setup.computePCE1<CoshFunc>(setup.u2, setup.x);
460  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
461  setup.rtol, setup.atol, out);
462  }
463  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, CoshConst ) {
464  setup.exp->cosh(setup.cu, setup.cx);
465  setup.cu2[0] = std::cosh(setup.cx[0]);
466  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
467  setup.crtol, setup.catol, out);
468  }
469  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, CoshResize ) {
471  setup.exp->cosh(ru, setup.x);
472  setup.computePCE1<CoshFunc>(setup.u2, setup.x);
473  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
474  setup.rtol, setup.atol, out);
475  }
476  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Tanh ) {
477  setup.exp->tanh(setup.u, setup.x);
478  setup.computePCE1<TanhFunc>(setup.u2, setup.x);
479  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
480  setup.rtol, setup.atol, out);
481  }
482  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TanhConst ) {
483  setup.exp->tanh(setup.cu, setup.cx);
484  setup.cu2[0] = std::tanh(setup.cx[0]);
485  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
486  setup.crtol, setup.catol, out);
487  }
488  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TanhResize ) {
490  setup.exp->tanh(ru, setup.x);
491  setup.computePCE1<TanhFunc>(setup.u2, setup.x);
492  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
493  setup.rtol, setup.atol, out);
494  }
495  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ASin ) {
496  setup.exp->asin(setup.u, setup.x);
497  setup.computePCE1<ASinFunc>(setup.u2, setup.x);
498  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
499  setup.rtol, setup.atol, out);
500  }
501  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ASinConst ) {
502  setup.exp->asin(setup.cu, setup.cx);
503  setup.cu2[0] = std::asin(setup.cx[0]);
504  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
505  setup.crtol, setup.catol, out);
506  }
507  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ASinResize ) {
509  setup.exp->asin(ru, setup.x);
510  setup.computePCE1<ASinFunc>(setup.u2, setup.x);
511  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
512  setup.rtol, setup.atol, out);
513  }
514  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ACos ) {
515  setup.exp->acos(setup.u, setup.x);
516  setup.computePCE1<ACosFunc>(setup.u2, setup.x);
517  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
518  setup.rtol, setup.atol, out);
519  }
520  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ACosConst ) {
521  setup.exp->acos(setup.cu, setup.cx);
522  setup.cu2[0] = std::acos(setup.cx[0]);
523  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
524  setup.crtol, setup.catol, out);
525  }
526  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ACosResize ) {
528  setup.exp->acos(ru, setup.x);
529  setup.computePCE1<ACosFunc>(setup.u2, setup.x);
530  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
531  setup.rtol, setup.atol, out);
532  }
533  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ATan ) {
534  setup.exp->atan(setup.u, setup.x);
535  setup.computePCE1<ATanFunc>(setup.u2, setup.x);
536  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
537  setup.rtol, setup.atol, out);
538  }
539  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ATanConst ) {
540  setup.exp->atan(setup.cu, setup.cx);
541  setup.cu2[0] = std::atan(setup.cx[0]);
542  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
543  setup.crtol, setup.catol, out);
544  }
545  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ATanResize ) {
547  setup.exp->atan(ru, setup.x);
548  setup.computePCE1<ATanFunc>(setup.u2, setup.x);
549  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
550  setup.rtol, setup.atol, out);
551  }
552  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ASinh ) {
553  setup.exp->asinh(setup.u, setup.x);
554  setup.computePCE1<ASinhFunc>(setup.u2, setup.x);
555  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
556  setup.rtol, setup.atol, out);
557  }
558  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ASinhConst ) {
559  ASinhFunc f;
560  setup.exp->asinh(setup.cu, setup.cx);
561  setup.cu2[0] = f(setup.cx[0]);
562  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
563  setup.crtol, setup.catol, out);
564  }
565  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ASinhResize ) {
567  setup.exp->asinh(ru, setup.x);
568  setup.computePCE1<ASinhFunc>(setup.u2, setup.x);
569  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
570  setup.rtol, setup.atol, out);
571  }
572  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ACosh ) {
573  setup.exp->acosh(setup.u, setup.x);
574  setup.computePCE1<ACoshFunc>(setup.u2, setup.x);
575  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
576  setup.rtol, setup.atol, out);
577  }
578  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ACoshConst ) {
579  ACoshFunc f;
580  setup.exp->acosh(setup.cu, setup.cx);
581  setup.cu2[0] = f(setup.cx[0]);
582  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
583  setup.crtol, setup.catol, out);
584  }
585  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ACoshResize ) {
587  setup.exp->acosh(ru, setup.x);
588  setup.computePCE1<ACoshFunc>(setup.u2, setup.x);
589  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
590  setup.rtol, setup.atol, out);
591  }
592  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ATanh ) {
593  setup.exp->atanh(setup.u, setup.x);
594  setup.computePCE1<ATanhFunc>(setup.u2, setup.x);
595  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
596  setup.rtol, setup.atol, out);
597  }
598  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ATanhConst ) {
599  ATanhFunc f;
600  setup.exp->atanh(setup.cu, setup.cx);
601  setup.cu2[0] = f(setup.cx[0]);
602  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
603  setup.crtol, setup.catol, out);
604  }
605  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, ATanhResize ) {
607  setup.exp->atanh(ru, setup.x);
608  setup.computePCE1<ATanhFunc>(setup.u2, setup.x);
609  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
610  setup.rtol, setup.atol, out);
611  }
612 
613  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Plus ) {
615  setup.exp->sin(v, setup.x);
616  setup.exp->cos(w, setup.y);
617  setup.exp->plus(setup.u, v, w);
618  setup.computePCE2<PlusFunc>(setup.u2, v, w);
619  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
620  setup.rtol, setup.atol, out);
621  }
622  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusLC ) {
624  setup.exp->sin(v, setup.x);
625  setup.exp->plus(setup.u, setup.a, v);
626  setup.computePCE2LC<PlusFunc>(setup.u2, setup.a, v);
627  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
628  setup.rtol, setup.atol, out);
629  }
630  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusRC ) {
632  setup.exp->sin(v, setup.x);
633  setup.exp->plus(setup.u, v, setup.a);
634  setup.computePCE2RC<PlusFunc>(setup.u2, v, setup.a);
635  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
636  setup.rtol, setup.atol, out);
637  }
638  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusCC ) {
639  setup.exp->plus(setup.cu, setup.cx, setup.cx);
640  setup.computePCE2<PlusFunc>(setup.cu2, setup.cx, setup.cx);
641  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
642  setup.rtol, setup.atol, out);
643  }
644  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusLC2 ) {
646  setup.exp->sin(v, setup.x);
647  setup.exp->plus(setup.u, setup.cx, v);
648  setup.computePCE2LC<PlusFunc>(setup.u2, setup.cx[0], v);
649  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
650  setup.rtol, setup.atol, out);
651  }
652  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusRC2 ) {
654  setup.exp->sin(v, setup.x);
655  setup.exp->plus(setup.u, v, setup.cx);
656  setup.computePCE2RC<PlusFunc>(setup.u2, v, setup.cx[0]);
657  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
658  setup.rtol, setup.atol, out);
659  }
660  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusResize ) {
663  setup.exp->sin(v, setup.x);
664  setup.exp->cos(w, setup.y);
665  setup.exp->plus(ru, v, w);
666  setup.computePCE2<PlusFunc>(setup.u2, v, w);
667  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
668  setup.rtol, setup.atol, out);
669  }
670  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusLCResize ) {
673  setup.exp->sin(v, setup.x);
674  setup.exp->plus(ru, setup.a, v);
675  setup.computePCE2LC<PlusFunc>(setup.u2, setup.a, v);
676  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
677  setup.rtol, setup.atol, out);
678  }
679  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusRCResize ) {
682  setup.exp->sin(v, setup.x);
683  setup.exp->plus(ru, v, setup.a);
684  setup.computePCE2RC<PlusFunc>(setup.u2, v, setup.a);
685  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
686  setup.rtol, setup.atol, out);
687  }
688  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusLS ) {
690  setup.exp->sin(v, setup.x);
691  setup.exp->plus(setup.u, setup.sx, v);
692  setup.computePCE2<PlusFunc>(setup.u2, setup.sx, v);
693  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
694  setup.rtol, setup.atol, out);
695  }
696  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusRS ) {
698  setup.exp->sin(v, setup.x);
699  setup.exp->plus(setup.u, v, setup.sx);
700  setup.computePCE2<PlusFunc>(setup.u2, v, setup.sx);
701  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
702  setup.rtol, setup.atol, out);
703  }
704  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusLSRC ) {
705  setup.exp->plus(setup.su, setup.sx, setup.a);
706  setup.computePCE2RC<PlusFunc>(setup.su2, setup.sx, setup.a);
707  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
708  setup.rtol, setup.atol, out);
709  }
710  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusRSLC ) {
711  setup.exp->plus(setup.su, setup.a, setup.sx);
712  setup.computePCE2LC<PlusFunc>(setup.su2, setup.a, setup.sx);
713  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
714  setup.rtol, setup.atol, out);
715  }
716  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusLSRC2 ) {
717  setup.exp->plus(setup.su, setup.sx, setup.cx);
718  setup.computePCE2<PlusFunc>(setup.su2, setup.sx, setup.cx);
719  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
720  setup.rtol, setup.atol, out);
721  }
722  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusRSLC2 ) {
723  setup.exp->plus(setup.su, setup.cx, setup.sx);
724  setup.computePCE2<PlusFunc>(setup.su2, setup.cx, setup.sx);
725  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
726  setup.rtol, setup.atol, out);
727  }
728 
729  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Minus ) {
731  setup.exp->sin(v, setup.x);
732  setup.exp->cos(w, setup.y);
733  setup.exp->minus(setup.u, v, w);
734  setup.computePCE2<MinusFunc>(setup.u2, v, w);
735  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
736  setup.rtol, setup.atol, out);
737  }
738  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusLC ) {
740  setup.exp->sin(v, setup.x);
741  setup.exp->minus(setup.u, setup.a, v);
742  setup.computePCE2LC<MinusFunc>(setup.u2, setup.a, v);
743  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
744  setup.rtol, setup.atol, out);
745  }
746  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusRC ) {
748  setup.exp->sin(v, setup.x);
749  setup.exp->minus(setup.u, v, setup.a);
750  setup.computePCE2RC<MinusFunc>(setup.u2, v, setup.a);
751  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
752  setup.rtol, setup.atol, out);
753  }
754  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusCC ) {
755  setup.exp->minus(setup.cu, setup.cx, setup.cx);
756  setup.computePCE2<MinusFunc>(setup.cu2, setup.cx, setup.cx);
757  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
758  setup.rtol, setup.atol, out);
759  }
760  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusLC2 ) {
762  setup.exp->sin(v, setup.x);
763  setup.exp->minus(setup.u, setup.cx, v);
764  setup.computePCE2LC<MinusFunc>(setup.u2, setup.cx[0], v);
765  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
766  setup.rtol, setup.atol, out);
767  }
768  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusRC2 ) {
770  setup.exp->sin(v, setup.x);
771  setup.exp->minus(setup.u, v, setup.cx);
772  setup.computePCE2RC<MinusFunc>(setup.u2, v, setup.cx[0]);
773  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
774  setup.rtol, setup.atol, out);
775  }
776  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusResize ) {
779  setup.exp->sin(v, setup.x);
780  setup.exp->cos(w, setup.y);
781  setup.exp->minus(ru, v, w);
782  setup.computePCE2<MinusFunc>(setup.u2, v, w);
783  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
784  setup.rtol, setup.atol, out);
785  }
786  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusLCResize ) {
789  setup.exp->sin(v, setup.x);
790  setup.exp->minus(ru, setup.a, v);
791  setup.computePCE2LC<MinusFunc>(setup.u2, setup.a, v);
792  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
793  setup.rtol, setup.atol, out);
794  }
795  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusRCResize ) {
798  setup.exp->sin(v, setup.x);
799  setup.exp->minus(ru, v, setup.a);
800  setup.computePCE2RC<MinusFunc>(setup.u2, v, setup.a);
801  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
802  setup.rtol, setup.atol, out);
803  }
804  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusLS ) {
806  setup.exp->sin(v, setup.x);
807  setup.exp->minus(setup.u, setup.sx, v);
808  setup.computePCE2<MinusFunc>(setup.u2, setup.sx, v);
809  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
810  setup.rtol, setup.atol, out);
811  }
812  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusRS ) {
814  setup.exp->sin(v, setup.x);
815  setup.exp->minus(setup.u, v, setup.sx);
816  setup.computePCE2<MinusFunc>(setup.u2, v, setup.sx);
817  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
818  setup.rtol, setup.atol, out);
819  }
820  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusLSRC ) {
821  setup.exp->minus(setup.su, setup.sx, setup.a);
822  setup.computePCE2RC<MinusFunc>(setup.su2, setup.sx, setup.a);
823  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
824  setup.rtol, setup.atol, out);
825  }
826  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusRSLC ) {
827  setup.exp->minus(setup.su, setup.a, setup.sx);
828  setup.computePCE2LC<MinusFunc>(setup.su2, setup.a, setup.sx);
829  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
830  setup.rtol, setup.atol, out);
831  }
832  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusLSRC2 ) {
833  setup.exp->minus(setup.su, setup.sx, setup.cx);
834  setup.computePCE2<MinusFunc>(setup.su2, setup.sx, setup.cx);
835  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
836  setup.rtol, setup.atol, out);
837  }
838  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusRSLC2 ) {
839  setup.exp->minus(setup.su, setup.cx, setup.sx);
840  setup.computePCE2<MinusFunc>(setup.su2, setup.cx, setup.sx);
841  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
842  setup.rtol, setup.atol, out);
843  }
844 
845  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Times ) {
847  setup.exp->sin(v, setup.x);
848  setup.exp->cos(w, setup.y);
849  setup.exp->times(setup.u, v, w);
850  setup.computePCE2<TimesFunc>(setup.u2, v, w);
851  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
852  setup.rtol, setup.atol, out);
853  }
854  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLC ) {
856  setup.exp->sin(v, setup.x);
857  setup.exp->times(setup.u, setup.a, v);
858  setup.computePCE2LC<TimesFunc>(setup.u2, setup.a, v);
859  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
860  setup.rtol, setup.atol, out);
861  }
862  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRC ) {
864  setup.exp->sin(v, setup.x);
865  setup.exp->times(setup.u, v, setup.a);
866  setup.computePCE2RC<TimesFunc>(setup.u2, v, setup.a);
867  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
868  setup.rtol, setup.atol, out);
869  }
870  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesCC ) {
871  setup.exp->times(setup.cu, setup.cx, setup.cx);
872  setup.computePCE2<TimesFunc>(setup.cu2, setup.cx, setup.cx);
873  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
874  setup.rtol, setup.atol, out);
875  }
876  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLC2 ) {
878  setup.exp->sin(v, setup.x);
879  setup.exp->times(setup.u, setup.cx, v);
880  setup.computePCE2LC<TimesFunc>(setup.u2, setup.cx[0], v);
881  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
882  setup.rtol, setup.atol, out);
883  }
884  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRC2 ) {
886  setup.exp->sin(v, setup.x);
887  setup.exp->times(setup.u, v, setup.cx);
888  setup.computePCE2RC<TimesFunc>(setup.u2, v, setup.cx[0]);
889  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
890  setup.rtol, setup.atol, out);
891  }
892  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesResize ) {
895  setup.exp->sin(v, setup.x);
896  setup.exp->cos(w, setup.y);
897  setup.exp->times(ru, v, w);
898  setup.computePCE2<TimesFunc>(setup.u2, v, w);
899  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
900  setup.rtol, setup.atol, out);
901  }
902  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLCResize ) {
905  setup.exp->sin(v, setup.x);
906  setup.exp->times(ru, setup.a, v);
907  setup.computePCE2LC<TimesFunc>(setup.u2, setup.a, v);
908  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
909  setup.rtol, setup.atol, out);
910  }
911  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRCResize ) {
914  setup.exp->sin(v, setup.x);
915  setup.exp->times(ru, v, setup.a);
916  setup.computePCE2RC<TimesFunc>(setup.u2, v, setup.a);
917  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
918  setup.rtol, setup.atol, out);
919  }
920  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLS ) {
922  setup.exp->sin(v, setup.x);
923  setup.exp->times(setup.u, setup.sx, v);
924  setup.computePCE2<TimesFunc>(setup.u2, setup.sx, v);
925  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
926  setup.rtol, setup.atol, out);
927  }
928  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRS ) {
930  setup.exp->sin(v, setup.x);
931  setup.exp->times(setup.u, v, setup.sx);
932  setup.computePCE2<TimesFunc>(setup.u2, v, setup.sx);
933  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
934  setup.rtol, setup.atol, out);
935  }
936  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLSLinear ) {
938  setup.exp->sin(v, setup.x);
939  setup.exp_linear->times(setup.u, setup.sx, v);
940  setup.computePCE2<TimesFunc>(setup.u2, setup.sx, v);
941  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
942  setup.rtol, setup.atol, out);
943  }
944  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRSLinear ) {
946  setup.exp->sin(v, setup.x);
947  setup.exp_linear->times(setup.u, v, setup.sx);
948  setup.computePCE2<TimesFunc>(setup.u2, v, setup.sx);
949  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
950  setup.rtol, setup.atol, out);
951  }
952  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLSRC ) {
953  setup.exp->times(setup.su, setup.sx, setup.a);
954  setup.computePCE2RC<TimesFunc>(setup.su2, setup.sx, setup.a);
955  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
956  setup.rtol, setup.atol, out);
957  }
958  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRSLC ) {
959  setup.exp->times(setup.su, setup.a, setup.sx);
960  setup.computePCE2LC<TimesFunc>(setup.su2, setup.a, setup.sx);
961  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
962  setup.rtol, setup.atol, out);
963  }
964  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLSRC2 ) {
965  setup.exp->times(setup.su, setup.sx, setup.cx);
966  setup.computePCE2<TimesFunc>(setup.su2, setup.sx, setup.cx);
967  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
968  setup.rtol, setup.atol, out);
969  }
970  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRSLC2 ) {
971  setup.exp->times(setup.su, setup.cx, setup.sx);
972  setup.computePCE2<TimesFunc>(setup.su2, setup.cx, setup.sx);
973  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
974  setup.rtol, setup.atol, out);
975  }
976 
977  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Divide ) {
979  setup.exp->sin(v, setup.x);
980  setup.exp->exp(w, setup.y);
981  setup.exp->divide(setup.u, v, w);
982  setup.computePCE2<DivideFunc>(setup.u2, v, w);
983  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
984  setup.rtol, setup.atol, out);
985  }
986  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideLC ) {
988  setup.exp->sin(v, setup.x);
989  setup.exp->divide(setup.u, setup.a, v);
990  setup.computePCE2LC<DivideFunc>(setup.u2, setup.a, v);
991  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
992  setup.rtol, setup.atol, out);
993  }
994  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideRC ) {
996  setup.exp->sin(v, setup.x);
997  setup.exp->divide(setup.u, v, setup.a);
998  setup.computePCE2RC<DivideFunc>(setup.u2, v, setup.a);
999  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1000  setup.rtol, setup.atol, out);
1001  }
1002  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideCC ) {
1003  setup.exp->divide(setup.cu, setup.cx, setup.cx);
1004  setup.computePCE2<DivideFunc>(setup.cu2, setup.cx, setup.cx);
1005  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
1006  setup.rtol, setup.atol, out);
1007  }
1008  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideLC2 ) {
1010  setup.exp->sin(v, setup.x);
1011  setup.exp->divide(setup.u, setup.cx, v);
1012  setup.computePCE2LC<DivideFunc>(setup.u2, setup.cx[0], v);
1013  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1014  setup.rtol, setup.atol, out);
1015  }
1016  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideRC2 ) {
1018  setup.exp->sin(v, setup.x);
1019  setup.exp->divide(setup.u, v, setup.cx);
1020  setup.computePCE2RC<DivideFunc>(setup.u2, v, setup.cx[0]);
1021  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1022  setup.rtol, setup.atol, out);
1023  }
1024  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideResize ) {
1027  setup.exp->sin(v, setup.x);
1028  setup.exp->exp(w, setup.y);
1029  setup.exp->divide(ru, v, w);
1030  setup.computePCE2<DivideFunc>(setup.u2, v, w);
1031  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1032  setup.rtol, setup.atol, out);
1033  }
1034  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideLCResize ) {
1037  setup.exp->sin(v, setup.x);
1038  setup.exp->divide(ru, setup.a, v);
1039  setup.computePCE2LC<DivideFunc>(setup.u2, setup.a, v);
1040  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1041  setup.rtol, setup.atol, out);
1042  }
1043  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideRCResize ) {
1046  setup.exp->sin(v, setup.x);
1047  setup.exp->divide(ru, v, setup.a);
1048  setup.computePCE2RC<DivideFunc>(setup.u2, v, setup.a);
1049  success = Stokhos::comparePCEs(ru, "u", setup.u2, "u2",
1050  setup.rtol, setup.atol, out);
1051  }
1052  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideLS ) {
1054  setup.exp->sin(v, setup.x);
1055  setup.exp->divide(setup.u, setup.sx, v);
1056  setup.computePCE2<DivideFunc>(setup.u2, setup.sx, v);
1057  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1058  setup.rtol, setup.atol, out);
1059  }
1060  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideRS ) {
1062  setup.exp->sin(v, setup.x);
1063  setup.exp->divide(setup.u, v, setup.sx);
1064  setup.computePCE2<DivideFunc>(setup.u2, v, setup.sx);
1065  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1066  setup.rtol, setup.atol, out);
1067  }
1068  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideLSRC ) {
1069  setup.exp->divide(setup.su, setup.sx, setup.a);
1070  setup.computePCE2RC<DivideFunc>(setup.su2, setup.sx, setup.a);
1071  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1072  setup.rtol, setup.atol, out);
1073  }
1074  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideRSLC ) {
1075  setup.exp->divide(setup.u, setup.a, setup.sx);
1076  setup.computePCE2LC<DivideFunc>(setup.u2, setup.a, setup.sx);
1077  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1078  setup.rtol, setup.atol, out);
1079  }
1080  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideLSRC2 ) {
1081  setup.exp->divide(setup.su, setup.sx, setup.cx);
1082  setup.computePCE2<DivideFunc>(setup.su2, setup.sx, setup.cx);
1083  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1084  setup.rtol, setup.atol, out);
1085  }
1086  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideRSLC2 ) {
1087  setup.exp->divide(setup.u, setup.cx, setup.sx);
1088  setup.computePCE2<DivideFunc>(setup.u2, setup.cx, setup.sx);
1089  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1090  setup.rtol, setup.atol, out);
1091  }
1092 
1093  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Pow ) {
1094  setup.exp->pow(setup.u, setup.x, setup.y);
1095  setup.computePCE2<PowFunc>(setup.u2, setup.x, setup.y);
1096  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1097  setup.rtol, setup.atol, out);
1098  }
1099  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowLC ) {
1100  setup.exp->pow(setup.u, setup.a, setup.y);
1101  setup.computePCE2LC<PowFunc>(setup.u2, setup.a, setup.y);
1102  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1103  setup.rtol, setup.atol, out);
1104  }
1105  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowRC ) {
1106  setup.exp->pow(setup.u, setup.x, setup.a);
1107  setup.computePCE2RC<PowFunc>(setup.u2, setup.x, setup.a);
1108  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1109  setup.rtol, setup.atol, out);
1110  }
1111  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowCC ) {
1112  setup.exp->pow(setup.cu, setup.cx, setup.cx);
1113  setup.computePCE2<PowFunc>(setup.cu2, setup.cx, setup.cx);
1114  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
1115  setup.rtol, setup.atol, out);
1116  }
1117  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowLC2 ) {
1118  setup.exp->pow(setup.u, setup.cx, setup.y);
1119  setup.computePCE2LC<PowFunc>(setup.u2, setup.cx[0], setup.y);
1120  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1121  setup.rtol, setup.atol, out);
1122  }
1123  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowRC2 ) {
1124  setup.exp->pow(setup.u, setup.x, setup.cx);
1125  setup.computePCE2RC<PowFunc>(setup.u2, setup.x, setup.cx[0]);
1126  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1127  setup.rtol, setup.atol, out);
1128  }
1129  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowResize ) {
1131  setup.exp->pow(ru, setup.x, setup.y);
1132  setup.computePCE2<PowFunc>(setup.u2, setup.x, setup.y);
1133  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1134  setup.rtol, setup.atol, out);
1135  }
1136  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowLCResize ) {
1138  setup.exp->pow(ru, setup.a, setup.y);
1139  setup.computePCE2LC<PowFunc>(setup.u2, setup.a, setup.y);
1140  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1141  setup.rtol, setup.atol, out);
1142  }
1143  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowRCResize ) {
1145  setup.exp->pow(ru, setup.x, setup.a);
1146  setup.computePCE2RC<PowFunc>(setup.u2, setup.x, setup.a);
1147  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1148  setup.rtol, setup.atol, out);
1149  }
1150  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowLS ) {
1151  setup.exp->pow(setup.u, setup.sx, setup.y);
1152  setup.computePCE2<PowFunc>(setup.u2, setup.sx, setup.y);
1153  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1154  setup.rtol, setup.atol, out);
1155  }
1156  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowRS ) {
1157  setup.exp->pow(setup.u, setup.x, setup.sx);
1158  setup.computePCE2<PowFunc>(setup.u2, setup.x, setup.sx);
1159  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1160  setup.rtol, setup.atol, out);
1161  }
1162  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowLSRC ) {
1163  setup.exp->pow(setup.u, setup.sx, setup.a);
1164  setup.computePCE2RC<PowFunc>(setup.u2, setup.sx, setup.a);
1165  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1166  setup.rtol, setup.atol, out);
1167  }
1168  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowRSLC ) {
1169  setup.exp->pow(setup.u, setup.a, setup.sx);
1170  setup.computePCE2LC<PowFunc>(setup.u2, setup.a, setup.sx);
1171  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1172  setup.rtol, setup.atol, out);
1173  }
1174  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowLSRC2 ) {
1175  setup.exp->pow(setup.u, setup.sx, setup.cx);
1176  setup.computePCE2<PowFunc>(setup.u2, setup.sx, setup.cx);
1177  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1178  setup.rtol, setup.atol, out);
1179  }
1180  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowRSLC2 ) {
1181  setup.exp->pow(setup.u, setup.cx, setup.sx);
1182  setup.computePCE2<PowFunc>(setup.u2, setup.cx, setup.sx);
1183  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1184  setup.rtol, setup.atol, out);
1185  }
1186 
1187  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqual ) {
1189  setup.exp->sin(v, setup.x);
1190  setup.exp->cos(setup.u, setup.x);
1191  setup.computePCE2<PlusFunc>(setup.u2, setup.u, v);
1192  setup.exp->plusEqual(setup.u, v);
1193  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1194  setup.rtol, setup.atol, out);
1195  }
1196  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqualC ) {
1197  setup.exp->cos(setup.u, setup.x);
1198  setup.computePCE2RC<PlusFunc>(setup.u2, setup.u, setup.a);
1199  setup.exp->plusEqual(setup.u, setup.a);
1200  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1201  setup.rtol, setup.atol, out);
1202  }
1203  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqualC2 ) {
1204  setup.exp->cos(setup.u, setup.x);
1205  setup.computePCE2RC<PlusFunc>(setup.u2, setup.u, setup.cx[0]);
1206  setup.exp->plusEqual(setup.u, setup.cx);
1207  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1208  setup.rtol, setup.atol, out);
1209  }
1210  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqualResize ) {
1213  setup.exp->sin(v, setup.x);
1214  setup.exp->plusEqual(ru, v);
1215  success = Stokhos::comparePCEs(ru, "ru", v, "v",
1216  setup.rtol, setup.atol, out);
1217  }
1218  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqualS ) {
1219  setup.exp->cos(setup.u, setup.x);
1220  setup.computePCE2<PlusFunc>(setup.u2, setup.u, setup.sx);
1221  setup.exp->plusEqual(setup.u, setup.sx);
1222  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1223  setup.rtol, setup.atol, out);
1224  }
1225  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqualSC ) {
1226  setup.su = setup.sx;
1227  setup.computePCE2RC<PlusFunc>(setup.su2, setup.su, setup.a);
1228  setup.exp->plusEqual(setup.su, setup.a);
1229  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1230  setup.rtol, setup.atol, out);
1231  }
1232  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqualSC2 ) {
1233  setup.su = setup.sx;
1234  setup.computePCE2<PlusFunc>(setup.su2, setup.su, setup.cx);
1235  setup.exp->plusEqual(setup.su, setup.cx);
1236  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1237  setup.rtol, setup.atol, out);
1238  }
1239 
1240  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqual ) {
1242  setup.exp->sin(v, setup.x);
1243  setup.exp->cos(setup.u, setup.x);
1244  setup.computePCE2<MinusFunc>(setup.u2, setup.u, v);
1245  setup.exp->minusEqual(setup.u, v);
1246  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1247  setup.rtol, setup.atol, out);
1248  }
1249  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqualC ) {
1250  setup.exp->cos(setup.u, setup.x);
1251  setup.computePCE2RC<MinusFunc>(setup.u2, setup.u, setup.a);
1252  setup.exp->minusEqual(setup.u, setup.a);
1253  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1254  setup.rtol, setup.atol, out);
1255  }
1256  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqualC2 ) {
1257  setup.exp->cos(setup.u, setup.x);
1258  setup.computePCE2RC<MinusFunc>(setup.u2, setup.u, setup.cx[0]);
1259  setup.exp->minusEqual(setup.u, setup.cx);
1260  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1261  setup.rtol, setup.atol, out);
1262  }
1263  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqualResize ) {
1266  setup.exp->sin(v, setup.x);
1267  setup.exp->minusEqual(ru, v);
1268  setup.exp->unaryMinus(v, v);
1269  success = Stokhos::comparePCEs(ru, "ru", v, "v",
1270  setup.rtol, setup.atol, out);
1271  }
1272  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqualS ) {
1273  setup.exp->cos(setup.u, setup.x);
1274  setup.computePCE2<MinusFunc>(setup.u2, setup.u, setup.sx);
1275  setup.exp->minusEqual(setup.u, setup.sx);
1276  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1277  setup.rtol, setup.atol, out);
1278  }
1279  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqualSC ) {
1280  setup.su = setup.sx;
1281  setup.computePCE2RC<MinusFunc>(setup.su2, setup.su, setup.a);
1282  setup.exp->minusEqual(setup.su, setup.a);
1283  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1284  setup.rtol, setup.atol, out);
1285  }
1286  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqualSC2 ) {
1287  setup.su = setup.sx;
1288  setup.computePCE2<MinusFunc>(setup.su2, setup.su, setup.cx);
1289  setup.exp->minusEqual(setup.su, setup.cx);
1290  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1291  setup.rtol, setup.atol, out);
1292  }
1293 
1294  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqual ) {
1296  setup.exp->sin(v, setup.x);
1297  setup.exp->cos(setup.u, setup.x);
1298  setup.computePCE2<TimesFunc>(setup.u2, setup.u, v);
1299  setup.exp->timesEqual(setup.u, v);
1300  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1301  setup.rtol, setup.atol, out);
1302  }
1303  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualC ) {
1304  setup.exp->cos(setup.u, setup.x);
1305  setup.computePCE2RC<TimesFunc>(setup.u2, setup.u, setup.a);
1306  setup.exp->timesEqual(setup.u, setup.a);
1307  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1308  setup.rtol, setup.atol, out);
1309  }
1310  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualC2 ) {
1311  setup.exp->cos(setup.u, setup.x);
1312  setup.computePCE2RC<TimesFunc>(setup.u2, setup.u, setup.cx[0]);
1313  setup.exp->timesEqual(setup.u, setup.cx);
1314  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1315  setup.rtol, setup.atol, out);
1316  }
1317  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualResize ) {
1319  setup.exp->sin(v, setup.x);
1320  setup.su = setup.sx;
1321  setup.computePCE2<TimesFunc>(setup.u2, setup.su, v);
1322  setup.exp->timesEqual(setup.su, v);
1323  success = Stokhos::comparePCEs(setup.su, "su", setup.u2, "u2",
1324  setup.rtol, setup.atol, out);
1325  }
1326  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualS ) {
1327  setup.exp->cos(setup.u, setup.x);
1328  setup.computePCE2<TimesFunc>(setup.u2, setup.u, setup.sx);
1329  setup.exp->timesEqual(setup.u, setup.sx);
1330  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1331  setup.rtol, setup.atol, out);
1332  }
1333  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualSLinear ) {
1334  setup.exp->cos(setup.u, setup.x);
1335  setup.computePCE2<TimesFunc>(setup.u2, setup.u, setup.sx);
1336  setup.exp_linear->timesEqual(setup.u, setup.sx);
1337  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1338  setup.rtol, setup.atol, out);
1339  }
1340  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualSC ) {
1341  setup.su = setup.sx;
1342  setup.computePCE2RC<TimesFunc>(setup.su2, setup.su, setup.a);
1343  setup.exp->timesEqual(setup.su, setup.a);
1344  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1345  setup.rtol, setup.atol, out);
1346  }
1347  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualSC2 ) {
1348  setup.su = setup.sx;
1349  setup.computePCE2<TimesFunc>(setup.su2, setup.su, setup.cx);
1350  setup.exp->timesEqual(setup.su, setup.cx);
1351  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1352  setup.rtol, setup.atol, out);
1353  }
1354 
1355  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqual ) {
1357  setup.exp->sin(v, setup.x);
1358  setup.exp->cos(setup.u, setup.x);
1359  setup.computePCE2<DivideFunc>(setup.u2, setup.u, v);
1360  setup.exp->divideEqual(setup.u, v);
1361  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1362  setup.rtol, setup.atol, out);
1363  }
1364  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqualC ) {
1365  setup.exp->cos(setup.u, setup.x);
1366  setup.computePCE2RC<DivideFunc>(setup.u2, setup.u, setup.a);
1367  setup.exp->divideEqual(setup.u, setup.a);
1368  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1369  setup.rtol, setup.atol, out);
1370  }
1371  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqualC2 ) {
1372  setup.exp->cos(setup.u, setup.x);
1373  setup.computePCE2RC<DivideFunc>(setup.u2, setup.u, setup.cx[0]);
1374  setup.exp->divideEqual(setup.u, setup.cx);
1375  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1376  setup.rtol, setup.atol, out);
1377  }
1378  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqualResize ) {
1380  setup.exp->sin(v, setup.x);
1381  setup.su = setup.sx;
1382  setup.computePCE2<DivideFunc>(setup.u2, setup.su, v);
1383  setup.exp->divideEqual(setup.su, v);
1384  success = Stokhos::comparePCEs(setup.su, "su", setup.u2, "u2",
1385  setup.rtol, setup.atol, out);
1386  }
1387  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqualS ) {
1388  setup.exp->cos(setup.u, setup.x);
1389  setup.computePCE2<DivideFunc>(setup.u2, setup.u, setup.sx);
1390  setup.exp->divideEqual(setup.u, setup.sx);
1391  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1392  setup.rtol, setup.atol, out);
1393  }
1394  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqualSC ) {
1395  setup.su = setup.sx;
1396  setup.computePCE2RC<DivideFunc>(setup.su2, setup.su, setup.a);
1397  setup.exp->divideEqual(setup.su, setup.a);
1398  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1399  setup.rtol, setup.atol, out);
1400  }
1401  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqualSC2 ) {
1402  setup.su = setup.sx;
1403  setup.computePCE2<DivideFunc>(setup.su2, setup.su, setup.cx);
1404  setup.exp->divideEqual(setup.su, setup.cx);
1405  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1406  setup.rtol, setup.atol, out);
1407  }
1408 
1409  // Not testing atan2(), max(), min(), abs(), fabs() since these are
1410  // not smooth functions
1411 
1412 }
1413 
1414 int main( int argc, char* argv[] ) {
1415  Teuchos::GlobalMPISession mpiSession(&argc, &argv);
1417 }
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > tan(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu2
TEUCHOS_UNIT_TEST(Stokhos_QuadExpansion, UMinus)
KOKKOS_INLINE_FUNCTION PCE< Storage > sinh(const PCE< Storage > &a)
value_type evaluate(const Teuchos::Array< value_type > &point) const
Evaluate polynomial approximation at a point.
void computePCE2(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
void computePCE2RC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, ValueType b)
double operator()(double a, double b) const
bool comparePCEs(const PCEType &a1, const std::string &a1_name, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getBasisAtQuadPoints() const =0
Get values of basis at quadrature points.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cx
void computePCE2LC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, ValueType a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
KOKKOS_INLINE_FUNCTION PCE< Storage > tanh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cbrt(const PCE< Storage > &a)
Teuchos::RCP< const Stokhos::CompletePolynomialBasis< OrdinalType, ValueType > > basis
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su
virtual const Teuchos::Array< value_type > & getQuadWeights() const =0
Get quadrature weights.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > sx
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getQuadPoints() const =0
Get quadrature points.
static int runUnitTestsFromMain(int argc, char *argv[])
Teuchos::RCP< const Stokhos::Quadrature< OrdinalType, ValueType > > quad
UnitTestSetup< int, double > setup
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void reset(const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > &new_basis, ordinal_type sz=0)
Reset to a new basis.
void computePCE1(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a)
Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > > exp_linear
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su2
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
KOKKOS_INLINE_FUNCTION PCE< Storage > cosh(const PCE< Storage > &a)
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk_linear
double operator()(double a, double b) const
double operator()(double a, double b) const
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
double operator()(double a, double b) const
int main(int argc, char **argv)
expr val()
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
size_type size() const
virtual ordinal_type size() const
Return total size of basis.
double operator()(double a, double b) const
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
ordinal_type size() const
Return size.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u2
Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > > exp
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
KOKKOS_INLINE_FUNCTION PCE< Storage > asin(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > x
KOKKOS_INLINE_FUNCTION PCE< Storage > cos(const PCE< Storage > &a)
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > y
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.