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