Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_ForUQTKExpansionUnitTest.cpp
Go to the documentation of this file.
1 // $Id$
2 // $Source$
3 // @HEADER
4 // ***********************************************************************
5 //
6 // Stokhos Package
7 // Copyright (2009) Sandia Corporation
8 //
9 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
10 // license for use of this work by or on behalf of the U.S. Government.
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are
14 // met:
15 //
16 // 1. Redistributions of source code must retain the above copyright
17 // notice, this list of conditions and the following disclaimer.
18 //
19 // 2. Redistributions in binary form must reproduce the above copyright
20 // notice, this list of conditions and the following disclaimer in the
21 // documentation and/or other materials provided with the distribution.
22 //
23 // 3. Neither the name of the Corporation nor the names of the
24 // contributors may be used to endorse or promote products derived from
25 // this software without specific prior written permission.
26 //
27 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
28 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
31 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 //
39 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
40 //
41 // ***********************************************************************
42 // @HEADER
43 
48 
49 #include "Stokhos.hpp"
51 
52 namespace ForUQTKExpansionUnitTest {
53 
54  // Common setup for unit tests
55  template <typename OrdinalType, typename ValueType>
56  struct UnitTestSetup {
57  ValueType rtol, atol;
58  ValueType crtol, catol;
59  OrdinalType sz;
65  ValueType a;
66 
68  rtol = 1e-4;
69  atol = 1e-5;
70  crtol = 1e-12;
71  catol = 1e-12;
72  a = 3.1;
73  const OrdinalType d = 2;
74  const OrdinalType p = 7;
75 
76  // Create product basis
78  for (OrdinalType i=0; i<d; i++)
79  bases[i] =
81  basis =
83 
84  // Triple product tensor
86 
87  // Tensor product quadrature
88  quad =
90 
91  // Quadrature expansion
92  exp =
93  Teuchos::rcp(new Stokhos::ForUQTKOrthogPolyExpansion<OrdinalType,ValueType>(basis, Cijk, Stokhos::ForUQTKOrthogPolyExpansion<OrdinalType,ValueType>::INTEGRATION));
94 
95  // Create approximation
96  sz = basis->size();
97  x.reset(basis);
98  y.reset(basis);
99  u.reset(basis);
100  u2.reset(basis);
101  cx.reset(basis, 1);
102  x.term(0, 0) = 1.0;
103  cx.term(0, 0) = a;
104  cu.reset(basis);
105  cu2.reset(basis, 1);
106  sx.reset(basis, d+1);
107  su.reset(basis, d+1);
108  su2.reset(basis, d+1);
109  for (OrdinalType i=0; i<d; i++) {
110  x.term(i, 1) = 0.1;
111  sx.term(i, 1) = 0.0;
112  }
113  y.term(0, 0) = 2.0;
114  for (OrdinalType i=0; i<d; i++)
115  y.term(i, 1) = 0.25;
116  }
117 
118  template <class Func>
121  {
122  // Quadrature data
123  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
125  quad->getQuadPoints();
128  OrdinalType nqp = weights.size();
129 
130  // Initialize
131  for (OrdinalType i=0; i<c.size(); i++)
132  c[i] = 0.0;
133 
134  // Compute PCE via quadrature
135  Func func;
136  for (OrdinalType k=0; k<nqp; k++) {
137  ValueType val = a.evaluate(points[k], values[k]);
138  val = func(val);
139  for (int i=0; i<c.size(); i++)
140  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
141  }
142  }
143 
144  template <class Func>
148  {
149  // Quadrature data
150  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
152  quad->getQuadPoints();
155  OrdinalType nqp = weights.size();
156 
157  // Initialize
158  for (OrdinalType i=0; i<c.size(); i++)
159  c[i] = 0.0;
160 
161  // Compute PCE via quadrature
162  Func func;
163  for (OrdinalType k=0; k<nqp; k++) {
164  ValueType val1 = a.evaluate(points[k], values[k]);
165  ValueType val2 = b.evaluate(points[k], values[k]);
166  ValueType val = func(val1, val2);
167  for (int i=0; i<c.size(); i++)
168  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
169  }
170  }
171 
172  template <class Func>
175  ValueType a,
177  {
178  // Quadrature data
179  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
181  quad->getQuadPoints();
184  OrdinalType nqp = weights.size();
185 
186  // Initialize
187  for (OrdinalType i=0; i<c.size(); i++)
188  c[i] = 0.0;
189 
190  // Compute PCE via quadrature
191  Func func;
192  for (OrdinalType k=0; k<nqp; k++) {
193  ValueType val2 = b.evaluate(points[k], values[k]);
194  ValueType val = func(a, val2);
195  for (int i=0; i<c.size(); i++)
196  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
197  }
198  }
199 
200  template <class Func>
204  ValueType b)
205  {
206  // Quadrature data
207  const Teuchos::Array<ValueType>& weights = quad->getQuadWeights();
209  quad->getQuadPoints();
212  OrdinalType nqp = weights.size();
213 
214  // Initialize
215  for (OrdinalType i=0; i<c.size(); i++)
216  c[i] = 0.0;
217 
218  // Compute PCE via quadrature
219  Func func;
220  for (OrdinalType k=0; k<nqp; k++) {
221  ValueType val1 = a.evaluate(points[k], values[k]);
222  ValueType val = func(val1, b);
223  for (int i=0; i<c.size(); i++)
224  c[i] += weights[k]*val*values[k][i] / basis->norm_squared(i);
225  }
226  }
227 
228  };
229 
231 
232  struct UMinusFunc {
233  double operator() (double a) const { return -a; }
234  };
235  struct ExpFunc {
236  double operator() (double a) const { return std::exp(a); }
237  };
238  struct LogFunc {
239  double operator() (double a) const { return std::log(a); }
240  };
241  struct Log10Func {
242  double operator() (double a) const { return std::log10(a); }
243  };
244  struct SqrtFunc {
245  double operator() (double a) const { return std::sqrt(a); }
246  };
247  struct CbrtFunc {
248  double operator() (double a) const { return std::sqrt(a); }
249  };
250  struct SinFunc {
251  double operator() (double a) const { return std::sin(a); }
252  };
253  struct CosFunc {
254  double operator() (double a) const { return std::cos(a); }
255  };
256  struct TanFunc {
257  double operator() (double a) const { return std::tan(a); }
258  };
259  struct SinhFunc {
260  double operator() (double a) const { return std::sinh(a); }
261  };
262  struct CoshFunc {
263  double operator() (double a) const { return std::cosh(a); }
264  };
265  struct TanhFunc {
266  double operator() (double a) const { return std::tanh(a); }
267  };
268  struct ASinFunc {
269  double operator() (double a) const { return std::asin(a); }
270  };
271  struct ACosFunc {
272  double operator() (double a) const { return std::acos(a); }
273  };
274  struct ATanFunc {
275  double operator() (double a) const { return std::atan(a); }
276  };
277  struct ASinhFunc {
278  double operator() (double a) const {
279  return std::log(a+std::sqrt(a*a+1.0));
280  }
281  };
282  struct ACoshFunc {
283  double operator() (double a) const {
284  return std::log(a+std::sqrt(a*a-1.0));
285  }
286  };
287  struct ATanhFunc {
288  double operator() (double a) const {
289  return 0.5*std::log((1.0+a)/(1.0-a));
290  }
291  };
292 
293  struct PlusFunc {
294  double operator() (double a, double b) const { return a + b; }
295  };
296  struct MinusFunc {
297  double operator() (double a, double b) const { return a - b; }
298  };
299  struct TimesFunc {
300  double operator() (double a, double b) const { return a * b; }
301  };
302  struct DivideFunc {
303  double operator() (double a, double b) const { return a / b; }
304  };
305  struct PowFunc {
306  double operator() (double a, double b) const { return std::pow(a,b); }
307  };
308 
309  /*
310  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, UMinus ) {
311  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
312  setup.exp->sinh(v, setup.x);
313  setup.exp->unaryMinus(setup.u, v);
314  setup.computePCE1<UMinusFunc>(setup.u2, v);
315  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
316  setup.rtol, setup.atol, out);
317  }
318  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Exp ) {
319  setup.exp->exp(setup.u, setup.x);
320  setup.computePCE1<ExpFunc>(setup.u2, setup.x);
321  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
322  setup.rtol, setup.atol, out);
323  }
324  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Log ) {
325  setup.exp->log(setup.u, setup.x);
326  setup.computePCE1<LogFunc>(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, Log10 ) {
331  setup.exp->log10(setup.u, setup.x);
332  setup.computePCE1<Log10Func>(setup.u2, setup.x);
333  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
334  setup.rtol, setup.atol, out);
335  }
336  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Sqrt ) {
337  setup.exp->sqrt(setup.u, setup.x);
338  setup.computePCE1<SqrtFunc>(setup.u2, setup.x);
339  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
340  setup.rtol, setup.atol, out);
341  }
342  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Cbrt ) {
343  setup.exp->cbrt(setup.u, setup.x);
344  setup.computePCE1<CbrtFunc>(setup.u2, setup.x);
345  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
346  setup.rtol, setup.atol, out);
347  }
348  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Sinh ) {
349  setup.exp->sinh(setup.u, setup.x);
350  setup.computePCE1<SinhFunc>(setup.u2, setup.x);
351  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
352  setup.rtol, setup.atol, out);
353  }
354  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Cosh ) {
355  setup.exp->cosh(setup.u, setup.x);
356  setup.computePCE1<CoshFunc>(setup.u2, setup.x);
357  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
358  setup.rtol, setup.atol, out);
359  }
360  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Tanh ) {
361  setup.exp->tanh(setup.u, setup.x);
362  setup.computePCE1<TanhFunc>(setup.u2, setup.x);
363  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
364  setup.rtol, setup.atol, out);
365  }
366 
367  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Plus ) {
368  Stokhos::OrthogPolyApprox<int,double> v(setup.basis), w(setup.basis);
369  setup.exp->sinh(v, setup.x);
370  setup.exp->cosh(w, setup.y);
371  setup.exp->plus(setup.u, v, w);
372  setup.computePCE2<PlusFunc>(setup.u2, v, w);
373  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
374  setup.rtol, setup.atol, out);
375  }
376  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusLC ) {
377  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
378  setup.exp->sinh(v, setup.x);
379  setup.exp->plus(setup.u, setup.a, v);
380  setup.computePCE2LC<PlusFunc>(setup.u2, setup.a, v);
381  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
382  setup.rtol, setup.atol, out);
383  }
384  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusRC ) {
385  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
386  setup.exp->sinh(v, setup.x);
387  setup.exp->plus(setup.u, v, setup.a);
388  setup.computePCE2RC<PlusFunc>(setup.u2, v, setup.a);
389  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
390  setup.rtol, setup.atol, out);
391  }
392  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Minus ) {
393  Stokhos::OrthogPolyApprox<int,double> v(setup.basis), w(setup.basis);
394  setup.exp->sinh(v, setup.x);
395  setup.exp->cosh(w, setup.y);
396  setup.exp->minus(setup.u, v, w);
397  setup.computePCE2<MinusFunc>(setup.u2, v, w);
398  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
399  setup.rtol, setup.atol, out);
400  }
401  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusLC ) {
402  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
403  setup.exp->sinh(v, setup.x);
404  setup.exp->minus(setup.u, setup.a, v);
405  setup.computePCE2LC<MinusFunc>(setup.u2, setup.a, v);
406  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
407  setup.rtol, setup.atol, out);
408  }
409  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusRC ) {
410  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
411  setup.exp->sinh(v, setup.x);
412  setup.exp->minus(setup.u, v, setup.a);
413  setup.computePCE2RC<MinusFunc>(setup.u2, v, setup.a);
414  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
415  setup.rtol, setup.atol, out);
416  }
417  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Times ) {
418  Stokhos::OrthogPolyApprox<int,double> v(setup.basis), w(setup.basis);
419  setup.exp->sinh(v, setup.x);
420  setup.exp->cosh(w, setup.y);
421  setup.exp->times(setup.u, v, w);
422  setup.computePCE2<TimesFunc>(setup.u2, v, w);
423  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
424  setup.rtol, setup.atol, out);
425  }
426  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesLC ) {
427  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
428  setup.exp->sinh(v, setup.x);
429  setup.exp->times(setup.u, setup.a, v);
430  setup.computePCE2LC<TimesFunc>(setup.u2, setup.a, v);
431  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
432  setup.rtol, setup.atol, out);
433  }
434  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesRC ) {
435  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
436  setup.exp->sinh(v, setup.x);
437  setup.exp->times(setup.u, v, setup.a);
438  setup.computePCE2RC<TimesFunc>(setup.u2, v, setup.a);
439  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
440  setup.rtol, setup.atol, out);
441  }
442  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Divide ) {
443  Stokhos::OrthogPolyApprox<int,double> v(setup.basis), w(setup.basis);
444  setup.exp->sinh(v, setup.x);
445  setup.exp->cosh(w, setup.y);
446  setup.exp->divide(setup.u, v, w);
447  setup.computePCE2<DivideFunc>(setup.u2, v, w);
448  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
449  setup.rtol, setup.atol, out);
450  }
451  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideLC ) {
452  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
453  setup.exp->sinh(v, setup.x);
454  setup.exp->divide(setup.u, setup.a, v);
455  setup.computePCE2LC<DivideFunc>(setup.u2, setup.a, v);
456  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
457  setup.rtol, setup.atol, out);
458  }
459  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideRC ) {
460  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
461  setup.exp->sinh(v, setup.x);
462  setup.exp->divide(setup.u, v, setup.a);
463  setup.computePCE2RC<DivideFunc>(setup.u2, v, setup.a);
464  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
465  setup.rtol, setup.atol, out);
466  }
467  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, Pow ) {
468  setup.exp->pow(setup.u, setup.x, setup.y);
469  setup.computePCE2<PowFunc>(setup.u2, setup.x, setup.y);
470  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
471  setup.rtol, setup.atol, out);
472  }
473  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowLC ) {
474  setup.exp->pow(setup.u, setup.a, setup.y);
475  setup.computePCE2LC<PowFunc>(setup.u2, setup.a, setup.y);
476  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
477  setup.rtol, setup.atol, out);
478  }
479  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PowRC ) {
480  setup.exp->pow(setup.u, setup.x, setup.a);
481  setup.computePCE2RC<PowFunc>(setup.u2, setup.x, setup.a);
482  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
483  setup.rtol, setup.atol, out);
484  }
485  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqual ) {
486  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
487  setup.exp->sinh(v, setup.x);
488  setup.exp->cosh(setup.u, setup.x);
489  setup.computePCE2<PlusFunc>(setup.u2, setup.u, v);
490  setup.exp->plusEqual(setup.u, v);
491  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
492  setup.rtol, setup.atol, out);
493  }
494  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, PlusEqualC ) {
495  setup.exp->cosh(setup.u, setup.x);
496  setup.computePCE2RC<PlusFunc>(setup.u2, setup.u, setup.a);
497  setup.exp->plusEqual(setup.u, setup.a);
498  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
499  setup.rtol, setup.atol, out);
500  }
501  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqual ) {
502  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
503  setup.exp->sinh(v, setup.x);
504  setup.exp->cosh(setup.u, setup.x);
505  setup.computePCE2<MinusFunc>(setup.u2, setup.u, v);
506  setup.exp->minusEqual(setup.u, v);
507  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
508  setup.rtol, setup.atol, out);
509  }
510  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, MinusEqualC ) {
511  setup.exp->cosh(setup.u, setup.x);
512  setup.computePCE2RC<MinusFunc>(setup.u2, setup.u, setup.a);
513  setup.exp->minusEqual(setup.u, setup.a);
514  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
515  setup.rtol, setup.atol, out);
516  }
517  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqual ) {
518  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
519  setup.exp->sinh(v, setup.x);
520  setup.exp->cosh(setup.u, setup.x);
521  setup.computePCE2<TimesFunc>(setup.u2, setup.u, v);
522  setup.exp->timesEqual(setup.u, v);
523  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
524  setup.rtol, setup.atol, out);
525  }
526  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, TimesEqualC ) {
527  setup.exp->cosh(setup.u, setup.x);
528  setup.computePCE2RC<TimesFunc>(setup.u2, setup.u, setup.a);
529  setup.exp->timesEqual(setup.u, setup.a);
530  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
531  setup.rtol, setup.atol, out);
532  }
533  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqual ) {
534  Stokhos::OrthogPolyApprox<int,double> v(setup.basis);
535  setup.exp->sinh(v, setup.x);
536  setup.exp->cosh(setup.u, setup.x);
537  setup.computePCE2<DivideFunc>(setup.u2, setup.u, v);
538  setup.exp->divideEqual(setup.u, v);
539  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
540  setup.rtol, setup.atol, out);
541  }
542  TEUCHOS_UNIT_TEST( Stokhos_QuadExpansion, DivideEqualC ) {
543  setup.exp->cosh(setup.u, setup.x);
544  setup.computePCE2RC<DivideFunc>(setup.u2, setup.u, setup.a);
545  setup.exp->divideEqual(setup.u, setup.a);
546  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
547  setup.rtol, setup.atol, out);
548  }
549  */
550 
551  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, UMinus ) {
553  setup.exp->sinh(v, setup.x);
554  setup.exp->unaryMinus(setup.u, v);
555  setup.computePCE1<UMinusFunc>(setup.u2, v);
556  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
557  setup.rtol, setup.atol, out);
558  }
559  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Exp ) {
560  setup.exp->exp(setup.u, setup.x);
561  setup.computePCE1<ExpFunc>(setup.u2, setup.x);
562  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
563  setup.rtol, setup.atol, out);
564  }
565  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ExpConst ) {
566  setup.exp->exp(setup.cu, setup.cx);
567  setup.cu2[0] = std::exp(setup.cx[0]);
568  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
569  setup.crtol, setup.catol, out);
570  }
571  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ExpResize ) {
573  setup.exp->exp(ru, setup.x);
574  setup.computePCE1<ExpFunc>(setup.u2, setup.x);
575  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
576  setup.rtol, setup.atol, out);
577  }
578  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Log ) {
579  setup.exp->log(setup.u, setup.x);
580  setup.computePCE1<LogFunc>(setup.u2, setup.x);
581  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
582  setup.rtol, setup.atol, out);
583  }
584  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, LogConst ) {
585  setup.exp->log(setup.cu, setup.cx);
586  setup.cu2[0] = std::log(setup.cx[0]);
587  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
588  setup.crtol, setup.catol, out);
589  }
590  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, LogResize ) {
592  setup.exp->log(ru, setup.x);
593  setup.computePCE1<LogFunc>(setup.u2, setup.x);
594  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
595  setup.rtol, setup.atol, out);
596  }
597  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Log10 ) {
598  setup.exp->log10(setup.u, setup.x);
599  setup.computePCE1<Log10Func>(setup.u2, setup.x);
600  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
601  setup.rtol, setup.atol, out);
602  }
603  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Log10Const ) {
604  setup.exp->log10(setup.cu, setup.cx);
605  setup.cu2[0] = std::log10(setup.cx[0]);
606  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
607  setup.crtol, setup.catol, out);
608  }
609  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Log10Resize ) {
611  setup.exp->log10(ru, setup.x);
612  setup.computePCE1<Log10Func>(setup.u2, setup.x);
613  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
614  setup.rtol, setup.atol, out);
615  }
616  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Sqrt ) {
617  setup.exp->sqrt(setup.u, setup.x);
618  setup.computePCE1<SqrtFunc>(setup.u2, setup.x);
619  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
620  setup.rtol, setup.atol, out);
621  }
622  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, SqrtConst ) {
623  setup.exp->sqrt(setup.cu, setup.cx);
624  setup.cu2[0] = std::sqrt(setup.cx[0]);
625  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
626  setup.crtol, setup.catol, out);
627  }
628  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, SqrtResize ) {
630  setup.exp->sqrt(ru, setup.x);
631  setup.computePCE1<SqrtFunc>(setup.u2, setup.x);
632  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
633  setup.rtol, setup.atol, out);
634  }
635  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Cbrt ) {
636  setup.exp->cbrt(setup.u, setup.x);
637  setup.computePCE1<CbrtFunc>(setup.u2, setup.x);
638  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
639  setup.rtol, setup.atol, out);
640  }
641  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, CbrtConst ) {
642  setup.exp->cbrt(setup.cu, setup.cx);
643  setup.cu2[0] = std::cbrt(setup.cx[0]);
644  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
645  setup.crtol, setup.catol, out);
646  }
647  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, CbrtResize ) {
649  setup.exp->cbrt(ru, setup.x);
650  setup.computePCE1<CbrtFunc>(setup.u2, setup.x);
651  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
652  setup.rtol, setup.atol, out);
653  }
654  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, SinConst ) {
655  setup.exp->sin(setup.cu, setup.cx);
656  setup.cu2[0] = std::sin(setup.cx[0]);
657  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
658  setup.crtol, setup.catol, out);
659  }
660  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, CosConst ) {
661  setup.exp->cos(setup.cu, setup.cx);
662  setup.cu2[0] = std::cos(setup.cx[0]);
663  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
664  setup.crtol, setup.catol, out);
665  }
666  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TanConst ) {
667  setup.exp->tan(setup.cu, setup.cx);
668  setup.cu2[0] = std::tan(setup.cx[0]);
669  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
670  setup.crtol, setup.catol, out);
671  }
672  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Sinh ) {
673  setup.exp->sinh(setup.u, setup.x);
674  setup.computePCE1<SinhFunc>(setup.u2, setup.x);
675  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
676  setup.rtol, setup.atol, out);
677  }
678  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, SinhConst ) {
679  setup.exp->sinh(setup.cu, setup.cx);
680  setup.cu2[0] = std::sinh(setup.cx[0]);
681  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
682  setup.crtol, setup.catol, out);
683  }
684  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, SinhResize ) {
686  setup.exp->sinh(ru, setup.x);
687  setup.computePCE1<SinhFunc>(setup.u2, setup.x);
688  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
689  setup.rtol, setup.atol, out);
690  }
691  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Cosh ) {
692  setup.exp->cosh(setup.u, setup.x);
693  setup.computePCE1<CoshFunc>(setup.u2, setup.x);
694  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
695  setup.rtol, setup.atol, out);
696  }
697  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, CoshConst ) {
698  setup.exp->cosh(setup.cu, setup.cx);
699  setup.cu2[0] = std::cosh(setup.cx[0]);
700  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
701  setup.crtol, setup.catol, out);
702  }
703  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, CoshResize ) {
705  setup.exp->cosh(ru, setup.x);
706  setup.computePCE1<CoshFunc>(setup.u2, setup.x);
707  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
708  setup.rtol, setup.atol, out);
709  }
710  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Tanh ) {
711  setup.exp->tanh(setup.u, setup.x);
712  setup.computePCE1<TanhFunc>(setup.u2, setup.x);
713  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
714  setup.rtol, setup.atol, out);
715  }
716  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TanhConst ) {
717  setup.exp->tanh(setup.cu, setup.cx);
718  setup.cu2[0] = std::tanh(setup.cx[0]);
719  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
720  setup.crtol, setup.catol, out);
721  }
722  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TanhResize ) {
724  setup.exp->tanh(ru, setup.x);
725  setup.computePCE1<TanhFunc>(setup.u2, setup.x);
726  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
727  setup.rtol, setup.atol, out);
728  }
729  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ASinConst ) {
730  setup.exp->asin(setup.cu, setup.cx);
731  setup.cu2[0] = std::asin(setup.cx[0]);
732  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
733  setup.crtol, setup.catol, out);
734  }
735  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ACosConst ) {
736  setup.exp->acos(setup.cu, setup.cx);
737  setup.cu2[0] = std::acos(setup.cx[0]);
738  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
739  setup.crtol, setup.catol, out);
740  }
741  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ATanConst ) {
742  setup.exp->atan(setup.cu, setup.cx);
743  setup.cu2[0] = std::atan(setup.cx[0]);
744  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
745  setup.crtol, setup.catol, out);
746  }
747  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ASinhConst ) {
748  ASinhFunc f;
749  setup.exp->asinh(setup.cu, setup.cx);
750  setup.cu2[0] = f(setup.cx[0]);
751  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
752  setup.crtol, setup.catol, out);
753  }
754  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ACoshConst ) {
755  ACoshFunc f;
756  setup.exp->acosh(setup.cu, setup.cx);
757  setup.cu2[0] = f(setup.cx[0]);
758  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
759  setup.crtol, setup.catol, out);
760  }
761  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, ATanhConst ) {
762  ATanhFunc f;
763  setup.exp->atanh(setup.cu, setup.cx);
764  setup.cu2[0] = f(setup.cx[0]);
765  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
766  setup.crtol, setup.catol, out);
767  }
768 
769  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Plus ) {
771  setup.exp->sinh(v, setup.x);
772  setup.exp->cosh(w, setup.y);
773  setup.exp->plus(setup.u, v, w);
774  setup.computePCE2<PlusFunc>(setup.u2, v, w);
775  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
776  setup.rtol, setup.atol, out);
777  }
778  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusLC ) {
780  setup.exp->sinh(v, setup.x);
781  setup.exp->plus(setup.u, setup.a, v);
782  setup.computePCE2LC<PlusFunc>(setup.u2, setup.a, v);
783  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
784  setup.rtol, setup.atol, out);
785  }
786  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusRC ) {
788  setup.exp->sinh(v, setup.x);
789  setup.exp->plus(setup.u, v, setup.a);
790  setup.computePCE2RC<PlusFunc>(setup.u2, v, setup.a);
791  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
792  setup.rtol, setup.atol, out);
793  }
794  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusCC ) {
795  setup.exp->plus(setup.cu, setup.cx, setup.cx);
796  setup.computePCE2<PlusFunc>(setup.cu2, setup.cx, setup.cx);
797  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
798  setup.rtol, setup.atol, out);
799  }
800  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusLC2 ) {
802  setup.exp->sinh(v, setup.x);
803  setup.exp->plus(setup.u, setup.cx, v);
804  setup.computePCE2LC<PlusFunc>(setup.u2, setup.cx[0], v);
805  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
806  setup.rtol, setup.atol, out);
807  }
808  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusRC2 ) {
810  setup.exp->sinh(v, setup.x);
811  setup.exp->plus(setup.u, v, setup.cx);
812  setup.computePCE2RC<PlusFunc>(setup.u2, v, setup.cx[0]);
813  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
814  setup.rtol, setup.atol, out);
815  }
816  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusResize ) {
819  setup.exp->sinh(v, setup.x);
820  setup.exp->cosh(w, setup.y);
821  setup.exp->plus(ru, v, w);
822  setup.computePCE2<PlusFunc>(setup.u2, v, w);
823  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
824  setup.rtol, setup.atol, out);
825  }
826  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusLCResize ) {
829  setup.exp->sinh(v, setup.x);
830  setup.exp->plus(ru, setup.a, v);
831  setup.computePCE2LC<PlusFunc>(setup.u2, setup.a, v);
832  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
833  setup.rtol, setup.atol, out);
834  }
835  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusRCResize ) {
838  setup.exp->sinh(v, setup.x);
839  setup.exp->plus(ru, v, setup.a);
840  setup.computePCE2RC<PlusFunc>(setup.u2, v, setup.a);
841  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
842  setup.rtol, setup.atol, out);
843  }
844  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusLS ) {
846  setup.exp->sinh(v, setup.x);
847  setup.exp->plus(setup.u, setup.sx, v);
848  setup.computePCE2<PlusFunc>(setup.u2, setup.sx, v);
849  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
850  setup.rtol, setup.atol, out);
851  }
852  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusRS ) {
854  setup.exp->sinh(v, setup.x);
855  setup.exp->plus(setup.u, v, setup.sx);
856  setup.computePCE2<PlusFunc>(setup.u2, v, setup.sx);
857  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
858  setup.rtol, setup.atol, out);
859  }
860  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusLSRC ) {
861  setup.exp->plus(setup.su, setup.sx, setup.a);
862  setup.computePCE2RC<PlusFunc>(setup.su2, setup.sx, setup.a);
863  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
864  setup.rtol, setup.atol, out);
865  }
866  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusRSLC ) {
867  setup.exp->plus(setup.su, setup.a, setup.sx);
868  setup.computePCE2LC<PlusFunc>(setup.su2, setup.a, setup.sx);
869  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
870  setup.rtol, setup.atol, out);
871  }
872  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusLSRC2 ) {
873  setup.exp->plus(setup.su, setup.sx, setup.cx);
874  setup.computePCE2<PlusFunc>(setup.su2, setup.sx, setup.cx);
875  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
876  setup.rtol, setup.atol, out);
877  }
878  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusRSLC2 ) {
879  setup.exp->plus(setup.su, setup.cx, setup.sx);
880  setup.computePCE2<PlusFunc>(setup.su2, setup.cx, setup.sx);
881  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
882  setup.rtol, setup.atol, out);
883  }
884 
885  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Minus ) {
887  setup.exp->sinh(v, setup.x);
888  setup.exp->cosh(w, setup.y);
889  setup.exp->minus(setup.u, v, w);
890  setup.computePCE2<MinusFunc>(setup.u2, v, w);
891  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
892  setup.rtol, setup.atol, out);
893  }
894  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusLC ) {
896  setup.exp->sinh(v, setup.x);
897  setup.exp->minus(setup.u, setup.a, v);
898  setup.computePCE2LC<MinusFunc>(setup.u2, setup.a, v);
899  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
900  setup.rtol, setup.atol, out);
901  }
902  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusRC ) {
904  setup.exp->sinh(v, setup.x);
905  setup.exp->minus(setup.u, v, setup.a);
906  setup.computePCE2RC<MinusFunc>(setup.u2, v, setup.a);
907  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
908  setup.rtol, setup.atol, out);
909  }
910  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusCC ) {
911  setup.exp->minus(setup.cu, setup.cx, setup.cx);
912  setup.computePCE2<MinusFunc>(setup.cu2, setup.cx, setup.cx);
913  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
914  setup.rtol, setup.atol, out);
915  }
916  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusLC2 ) {
918  setup.exp->sinh(v, setup.x);
919  setup.exp->minus(setup.u, setup.cx, v);
920  setup.computePCE2LC<MinusFunc>(setup.u2, setup.cx[0], v);
921  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
922  setup.rtol, setup.atol, out);
923  }
924  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusRC2 ) {
926  setup.exp->sinh(v, setup.x);
927  setup.exp->minus(setup.u, v, setup.cx);
928  setup.computePCE2RC<MinusFunc>(setup.u2, v, setup.cx[0]);
929  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
930  setup.rtol, setup.atol, out);
931  }
932  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusResize ) {
935  setup.exp->sinh(v, setup.x);
936  setup.exp->cosh(w, setup.y);
937  setup.exp->minus(ru, v, w);
938  setup.computePCE2<MinusFunc>(setup.u2, v, w);
939  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
940  setup.rtol, setup.atol, out);
941  }
942  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusLCResize ) {
945  setup.exp->sinh(v, setup.x);
946  setup.exp->minus(ru, setup.a, v);
947  setup.computePCE2LC<MinusFunc>(setup.u2, setup.a, v);
948  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
949  setup.rtol, setup.atol, out);
950  }
951  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusRCResize ) {
954  setup.exp->sinh(v, setup.x);
955  setup.exp->minus(ru, v, setup.a);
956  setup.computePCE2RC<MinusFunc>(setup.u2, v, setup.a);
957  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
958  setup.rtol, setup.atol, out);
959  }
960  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusLS ) {
962  setup.exp->sinh(v, setup.x);
963  setup.exp->minus(setup.u, setup.sx, v);
964  setup.computePCE2<MinusFunc>(setup.u2, setup.sx, v);
965  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
966  setup.rtol, setup.atol, out);
967  }
968  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusRS ) {
970  setup.exp->sinh(v, setup.x);
971  setup.exp->minus(setup.u, v, setup.sx);
972  setup.computePCE2<MinusFunc>(setup.u2, v, setup.sx);
973  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
974  setup.rtol, setup.atol, out);
975  }
976  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusLSRC ) {
977  setup.exp->minus(setup.su, setup.sx, setup.a);
978  setup.computePCE2RC<MinusFunc>(setup.su2, setup.sx, setup.a);
979  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
980  setup.rtol, setup.atol, out);
981  }
982  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusRSLC ) {
983  setup.exp->minus(setup.su, setup.a, setup.sx);
984  setup.computePCE2LC<MinusFunc>(setup.su2, setup.a, setup.sx);
985  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
986  setup.rtol, setup.atol, out);
987  }
988  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusLSRC2 ) {
989  setup.exp->minus(setup.su, setup.sx, setup.cx);
990  setup.computePCE2<MinusFunc>(setup.su2, setup.sx, setup.cx);
991  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
992  setup.rtol, setup.atol, out);
993  }
994  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusRSLC2 ) {
995  setup.exp->minus(setup.su, setup.cx, setup.sx);
996  setup.computePCE2<MinusFunc>(setup.su2, setup.cx, setup.sx);
997  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
998  setup.rtol, setup.atol, out);
999  }
1000 
1001  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Times ) {
1003  setup.exp->sinh(v, setup.x);
1004  setup.exp->cosh(w, setup.y);
1005  setup.exp->times(setup.u, v, w);
1006  setup.computePCE2<TimesFunc>(setup.u2, v, w);
1007  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1008  setup.rtol, setup.atol, out);
1009  }
1010  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesLC ) {
1012  setup.exp->sinh(v, setup.x);
1013  setup.exp->times(setup.u, setup.a, v);
1014  setup.computePCE2LC<TimesFunc>(setup.u2, setup.a, v);
1015  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1016  setup.rtol, setup.atol, out);
1017  }
1018  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesRC ) {
1020  setup.exp->sinh(v, setup.x);
1021  setup.exp->times(setup.u, v, setup.a);
1022  setup.computePCE2RC<TimesFunc>(setup.u2, v, setup.a);
1023  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1024  setup.rtol, setup.atol, out);
1025  }
1026  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesCC ) {
1027  setup.exp->times(setup.cu, setup.cx, setup.cx);
1028  setup.computePCE2<TimesFunc>(setup.cu2, setup.cx, setup.cx);
1029  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
1030  setup.rtol, setup.atol, out);
1031  }
1032  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesLC2 ) {
1034  setup.exp->sinh(v, setup.x);
1035  setup.exp->times(setup.u, setup.cx, v);
1036  setup.computePCE2LC<TimesFunc>(setup.u2, setup.cx[0], v);
1037  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1038  setup.rtol, setup.atol, out);
1039  }
1040  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesRC2 ) {
1042  setup.exp->sinh(v, setup.x);
1043  setup.exp->times(setup.u, v, setup.cx);
1044  setup.computePCE2RC<TimesFunc>(setup.u2, v, setup.cx[0]);
1045  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1046  setup.rtol, setup.atol, out);
1047  }
1048  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesResize ) {
1051  setup.exp->sinh(v, setup.x);
1052  setup.exp->cosh(w, setup.y);
1053  setup.exp->times(ru, v, w);
1054  setup.computePCE2<TimesFunc>(setup.u2, v, w);
1055  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1056  setup.rtol, setup.atol, out);
1057  }
1058  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesLCResize ) {
1061  setup.exp->sinh(v, setup.x);
1062  setup.exp->times(ru, setup.a, v);
1063  setup.computePCE2LC<TimesFunc>(setup.u2, setup.a, v);
1064  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1065  setup.rtol, setup.atol, out);
1066  }
1067  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesRCResize ) {
1070  setup.exp->sinh(v, setup.x);
1071  setup.exp->times(ru, v, setup.a);
1072  setup.computePCE2RC<TimesFunc>(setup.u2, v, setup.a);
1073  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1074  setup.rtol, setup.atol, out);
1075  }
1076 
1077  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Divide ) {
1079  setup.exp->sinh(v, setup.x);
1080  setup.exp->exp(w, setup.y);
1081  setup.exp->divide(setup.u, v, w);
1082  setup.computePCE2<DivideFunc>(setup.u2, v, w);
1083  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1084  setup.rtol, setup.atol, out);
1085  }
1086  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideLC ) {
1088  setup.exp->sinh(v, setup.x);
1089  setup.exp->divide(setup.u, setup.a, v);
1090  setup.computePCE2LC<DivideFunc>(setup.u2, setup.a, v);
1091  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1092  setup.rtol, setup.atol, out);
1093  }
1094  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideRC ) {
1096  setup.exp->sinh(v, setup.x);
1097  setup.exp->divide(setup.u, v, setup.a);
1098  setup.computePCE2RC<DivideFunc>(setup.u2, v, setup.a);
1099  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1100  setup.rtol, setup.atol, out);
1101  }
1102  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideCC ) {
1103  setup.exp->divide(setup.cu, setup.cx, setup.cx);
1104  setup.computePCE2<DivideFunc>(setup.cu2, setup.cx, setup.cx);
1105  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
1106  setup.rtol, setup.atol, out);
1107  }
1108  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideRC2 ) {
1110  setup.exp->sinh(v, setup.x);
1111  setup.exp->divide(setup.u, v, setup.cx);
1112  setup.computePCE2RC<DivideFunc>(setup.u2, v, setup.cx[0]);
1113  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1114  setup.rtol, setup.atol, out);
1115  }
1116  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideResize ) {
1119  setup.exp->sinh(v, setup.x);
1120  setup.exp->exp(w, setup.y);
1121  setup.exp->divide(ru, v, w);
1122  setup.computePCE2<DivideFunc>(setup.u2, v, w);
1123  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1124  setup.rtol, setup.atol, out);
1125  }
1126  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideLCResize ) {
1129  setup.exp->sinh(v, setup.x);
1130  setup.exp->divide(ru, setup.a, v);
1131  setup.computePCE2LC<DivideFunc>(setup.u2, setup.a, v);
1132  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1133  setup.rtol, setup.atol, out);
1134  }
1135  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideRCResize ) {
1138  setup.exp->sinh(v, setup.x);
1139  setup.exp->divide(ru, v, setup.a);
1140  setup.computePCE2RC<DivideFunc>(setup.u2, v, setup.a);
1141  success = Stokhos::comparePCEs(ru, "u", setup.u2, "u2",
1142  setup.rtol, setup.atol, out);
1143  }
1144 
1145  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, Pow ) {
1146  setup.exp->pow(setup.u, setup.x, setup.y);
1147  setup.computePCE2<PowFunc>(setup.u2, setup.x, setup.y);
1148  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1149  setup.rtol, setup.atol, out);
1150  }
1151  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowLC ) {
1152  setup.exp->pow(setup.u, setup.a, setup.y);
1153  setup.computePCE2LC<PowFunc>(setup.u2, setup.a, setup.y);
1154  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1155  setup.rtol, setup.atol, out);
1156  }
1157  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowRC ) {
1158  setup.exp->pow(setup.u, setup.x, setup.a);
1159  setup.computePCE2RC<PowFunc>(setup.u2, setup.x, setup.a);
1160  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1161  setup.rtol, setup.atol, out);
1162  }
1163  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowCC ) {
1164  setup.exp->pow(setup.cu, setup.cx, setup.cx);
1165  setup.computePCE2<PowFunc>(setup.cu2, setup.cx, setup.cx);
1166  success = Stokhos::comparePCEs(setup.cu, "cu", setup.cu2, "cu2",
1167  setup.rtol, setup.atol, out);
1168  }
1169  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowLC2 ) {
1170  setup.exp->pow(setup.u, setup.cx, setup.y);
1171  setup.computePCE2LC<PowFunc>(setup.u2, setup.cx[0], setup.y);
1172  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1173  setup.rtol, setup.atol, out);
1174  }
1175  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowRC2 ) {
1176  setup.exp->pow(setup.u, setup.x, setup.cx);
1177  setup.computePCE2RC<PowFunc>(setup.u2, setup.x, setup.cx[0]);
1178  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1179  setup.rtol, setup.atol, out);
1180  }
1181  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowResize ) {
1183  setup.exp->pow(ru, setup.x, setup.y);
1184  setup.computePCE2<PowFunc>(setup.u2, setup.x, setup.y);
1185  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1186  setup.rtol, setup.atol, out);
1187  }
1188  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowLCResize ) {
1190  setup.exp->pow(ru, setup.a, setup.y);
1191  setup.computePCE2LC<PowFunc>(setup.u2, setup.a, setup.y);
1192  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1193  setup.rtol, setup.atol, out);
1194  }
1195  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PowRCResize ) {
1197  setup.exp->pow(ru, setup.x, setup.a);
1198  setup.computePCE2RC<PowFunc>(setup.u2, setup.x, setup.a);
1199  success = Stokhos::comparePCEs(ru, "ru", setup.u2, "u2",
1200  setup.rtol, setup.atol, out);
1201  }
1202 
1203  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusEqual ) {
1205  setup.exp->sinh(v, setup.x);
1206  setup.exp->cosh(setup.u, setup.x);
1207  setup.computePCE2<PlusFunc>(setup.u2, setup.u, v);
1208  setup.exp->plusEqual(setup.u, v);
1209  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1210  setup.rtol, setup.atol, out);
1211  }
1212  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusEqualC ) {
1213  setup.exp->cosh(setup.u, setup.x);
1214  setup.computePCE2RC<PlusFunc>(setup.u2, setup.u, setup.a);
1215  setup.exp->plusEqual(setup.u, setup.a);
1216  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1217  setup.rtol, setup.atol, out);
1218  }
1219  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusEqualC2 ) {
1220  setup.exp->cosh(setup.u, setup.x);
1221  setup.computePCE2RC<PlusFunc>(setup.u2, setup.u, setup.cx[0]);
1222  setup.exp->plusEqual(setup.u, setup.cx);
1223  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1224  setup.rtol, setup.atol, out);
1225  }
1226  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusEqualResize ) {
1229  setup.exp->sinh(v, setup.x);
1230  setup.exp->plusEqual(ru, v);
1231  success = Stokhos::comparePCEs(ru, "ru", v, "v",
1232  setup.rtol, setup.atol, out);
1233  }
1234  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusEqualS ) {
1235  setup.exp->cosh(setup.u, setup.x);
1236  setup.computePCE2<PlusFunc>(setup.u2, setup.u, setup.sx);
1237  setup.exp->plusEqual(setup.u, setup.sx);
1238  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1239  setup.rtol, setup.atol, out);
1240  }
1241  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusEqualSC ) {
1242  setup.su = setup.sx;
1243  setup.computePCE2RC<PlusFunc>(setup.su2, setup.su, setup.a);
1244  setup.exp->plusEqual(setup.su, setup.a);
1245  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1246  setup.rtol, setup.atol, out);
1247  }
1248  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, PlusEqualSC2 ) {
1249  setup.su = setup.sx;
1250  setup.computePCE2<PlusFunc>(setup.su2, setup.su, setup.cx);
1251  setup.exp->plusEqual(setup.su, setup.cx);
1252  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1253  setup.rtol, setup.atol, out);
1254  }
1255 
1256  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusEqual ) {
1258  setup.exp->sinh(v, setup.x);
1259  setup.exp->cosh(setup.u, setup.x);
1260  setup.computePCE2<MinusFunc>(setup.u2, setup.u, v);
1261  setup.exp->minusEqual(setup.u, v);
1262  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1263  setup.rtol, setup.atol, out);
1264  }
1265  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusEqualC ) {
1266  setup.exp->cosh(setup.u, setup.x);
1267  setup.computePCE2RC<MinusFunc>(setup.u2, setup.u, setup.a);
1268  setup.exp->minusEqual(setup.u, setup.a);
1269  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1270  setup.rtol, setup.atol, out);
1271  }
1272  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusEqualC2 ) {
1273  setup.exp->cosh(setup.u, setup.x);
1274  setup.computePCE2RC<MinusFunc>(setup.u2, setup.u, setup.cx[0]);
1275  setup.exp->minusEqual(setup.u, setup.cx);
1276  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1277  setup.rtol, setup.atol, out);
1278  }
1279  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusEqualResize ) {
1282  setup.exp->sinh(v, setup.x);
1283  setup.exp->minusEqual(ru, v);
1284  setup.exp->unaryMinus(v, v);
1285  success = Stokhos::comparePCEs(ru, "ru", v, "v",
1286  setup.rtol, setup.atol, out);
1287  }
1288  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusEqualS ) {
1289  setup.exp->cosh(setup.u, setup.x);
1290  setup.computePCE2<MinusFunc>(setup.u2, setup.u, setup.sx);
1291  setup.exp->minusEqual(setup.u, setup.sx);
1292  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1293  setup.rtol, setup.atol, out);
1294  }
1295  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusEqualSC ) {
1296  setup.su = setup.sx;
1297  setup.computePCE2RC<MinusFunc>(setup.su2, setup.su, setup.a);
1298  setup.exp->minusEqual(setup.su, setup.a);
1299  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1300  setup.rtol, setup.atol, out);
1301  }
1302  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, MinusEqualSC2 ) {
1303  setup.su = setup.sx;
1304  setup.computePCE2<MinusFunc>(setup.su2, setup.su, setup.cx);
1305  setup.exp->minusEqual(setup.su, setup.cx);
1306  success = Stokhos::comparePCEs(setup.su, "su", setup.su2, "su2",
1307  setup.rtol, setup.atol, out);
1308  }
1309 
1310  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesEqual ) {
1312  setup.exp->sinh(v, setup.x);
1313  setup.exp->cosh(setup.u, setup.x);
1314  setup.computePCE2<TimesFunc>(setup.u2, setup.u, v);
1315  setup.exp->timesEqual(setup.u, v);
1316  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1317  setup.rtol, setup.atol, out);
1318  }
1319  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesEqualC ) {
1320  setup.exp->cosh(setup.u, setup.x);
1321  setup.computePCE2RC<TimesFunc>(setup.u2, setup.u, setup.a);
1322  setup.exp->timesEqual(setup.u, setup.a);
1323  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1324  setup.rtol, setup.atol, out);
1325  }
1326  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesEqualC2 ) {
1327  setup.exp->cosh(setup.u, setup.x);
1328  setup.computePCE2RC<TimesFunc>(setup.u2, setup.u, setup.cx[0]);
1329  setup.exp->timesEqual(setup.u, setup.cx);
1330  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1331  setup.rtol, setup.atol, out);
1332  }
1333  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, TimesEqualResize ) {
1335  setup.exp->sinh(v, setup.x);
1336  setup.su = setup.sx;
1337  setup.computePCE2<TimesFunc>(setup.u2, setup.su, v);
1338  setup.exp->timesEqual(setup.su, v);
1339  success = Stokhos::comparePCEs(setup.su, "su", setup.u2, "u2",
1340  setup.rtol, setup.atol, out);
1341  }
1342 
1343  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideEqual ) {
1345  setup.exp->sinh(v, setup.x);
1346  setup.exp->cosh(setup.u, setup.x);
1347  setup.computePCE2<DivideFunc>(setup.u2, setup.u, v);
1348  setup.exp->divideEqual(setup.u, v);
1349  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1350  setup.rtol, setup.atol, out);
1351  }
1352  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideEqualC ) {
1353  setup.exp->cosh(setup.u, setup.x);
1354  setup.computePCE2RC<DivideFunc>(setup.u2, setup.u, setup.a);
1355  setup.exp->divideEqual(setup.u, setup.a);
1356  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1357  setup.rtol, setup.atol, out);
1358  }
1359  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideEqualC2 ) {
1360  setup.exp->cosh(setup.u, setup.x);
1361  setup.computePCE2RC<DivideFunc>(setup.u2, setup.u, setup.cx[0]);
1362  setup.exp->divideEqual(setup.u, setup.cx);
1363  success = Stokhos::comparePCEs(setup.u, "u", setup.u2, "u2",
1364  setup.rtol, setup.atol, out);
1365  }
1366  TEUCHOS_UNIT_TEST( Stokhos_ForUQTKExpansion, DivideEqualResize ) {
1368  setup.exp->sinh(v, setup.x);
1369  setup.su = setup.sx;
1370  setup.computePCE2<DivideFunc>(setup.u2, setup.su, v);
1371  setup.exp->divideEqual(setup.su, v);
1372  success = Stokhos::comparePCEs(setup.su, "su", setup.u2, "u2",
1373  setup.rtol, setup.atol, out);
1374  }
1375 
1376  // Not testing atan2(), max(), min(), abs(), fabs() since these are
1377  // not smooth functions
1378 
1379 }
1380 
1381 int main( int argc, char* argv[] ) {
1382  Teuchos::GlobalMPISession mpiSession(&argc, &argv);
1384 }
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > tan(const PCE< Storage > &a)
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.
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu2
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &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.
KOKKOS_INLINE_FUNCTION PCE< Storage > tanh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cbrt(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su2
TEUCHOS_UNIT_TEST(Stokhos_ForUQTKExpansion, UMinus)
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu
virtual const Teuchos::Array< value_type > & getQuadWeights() const =0
Get quadrature weights.
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getQuadPoints() const =0
Get quadrature points.
static int runUnitTestsFromMain(int argc, char *argv[])
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > sx
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su
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::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
KOKKOS_INLINE_FUNCTION PCE< Storage > cosh(const PCE< Storage > &a)
Teuchos::RCP< Stokhos::ForUQTKOrthogPolyExpansion< OrdinalType, ValueType > > exp
void computePCE1(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
void computePCE2LC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, ValueType a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cx
Teuchos::RCP< const Stokhos::CompletePolynomialBasis< OrdinalType, ValueType > > basis
int main(int argc, char **argv)
expr val()
Teuchos::RCP< const Stokhos::Quadrature< OrdinalType, ValueType > > quad
void computePCE2RC(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, ValueType b)
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
void computePCE2(Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &c, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &b)
size_type size() const
virtual ordinal_type size() const
Return total size of basis.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > x
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
ordinal_type size() const
Return size.
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > y
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u2
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...
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.