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