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