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