Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
Sacado_ETPCE_OrthogPolyOps.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stokhos Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef SACADO_ETPCE_ORTHOGPOLY_OPS_HPP
43 #define SACADO_ETPCE_ORTHOGPOLY_OPS_HPP
44 
45 #include "Sacado_cmath.hpp"
46 #include <ostream> // for std::ostream
47 
48 #define LINEAR_PCE_UNARYOP_MACRO(OPNAME,OP,OPER) \
49 namespace Sacado { \
50  namespace ETPCE { \
51  \
52  template <typename ExprT> \
53  class OP {}; \
54  \
55  template <typename ExprT> \
56  class Expr< OP<ExprT> > { \
57  public: \
58  \
59  typedef typename ExprT::value_type value_type; \
60  typedef typename ExprT::approx_type approx_type; \
61  typedef typename ExprT::expansion_type expansion_type; \
62  typedef typename ExprT::quad_expansion_type quad_expansion_type; \
63  typedef typename ExprT::storage_type storage_type; \
64  typedef typename ExprT::base_expr_type base_expr_type; \
65  \
66  static const int num_args = ExprT::num_args; \
67  \
68  Expr(const ExprT& expr_) : expr(expr_) {} \
69  \
70  std::string name() const { \
71  return std::string(#OPER) + expr.name(); \
72  } \
73  \
74  int size() const { return expr.size(); } \
75  \
76  const approx_type& getArg(int i) const { return expr.getArg(i); } \
77  \
78  bool has_nonconst_expansion() const { \
79  return expr.has_nonconst_expansion(); \
80  } \
81  \
82  Teuchos::RCP<expansion_type> expansion() const { \
83  return expr.expansion(); \
84  } \
85  \
86  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
87  return expr.quad_expansion(); \
88  } \
89  \
90  bool has_fast_access(int sz) const { return expr.has_fast_access(sz); } \
91  \
92  int order() const { return expr.order(); } \
93  \
94  value_type val() const { return OPER (expr.val()); } \
95  \
96  value_type fast_higher_order_coeff(int i) const { \
97  return OPER (expr.fast_higher_order_coeff(i)); \
98  } \
99  \
100  value_type higher_order_coeff(int i) const { \
101  return OPER (expr.higher_order_coeff(i)); \
102  } \
103  \
104  template <int offset, typename tuple_type> \
105  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
106  return OPER (expr.template eval_sample<offset,tuple_type>(x)); \
107  } \
108  \
109  protected: \
110  \
111  const ExprT& expr; \
112  \
113  }; \
114  \
115  template <typename T> \
116  inline Expr< OP< Expr<T> > > \
117  OPNAME (const Expr<T>& expr) \
118  { \
119  typedef OP< Expr<T> > expr_t; \
120  \
121  return Expr<expr_t>(expr); \
122  } \
123  } \
124 }
125 
126 #define NONLINEAR_PCE_UNARYOP_MACRO(OPNAME,OP,OPER) \
127 namespace Sacado { \
128  namespace ETPCE { \
129  \
130  template <typename ExprT> \
131  class OP {}; \
132  \
133  template <typename ExprT> \
134  class Expr< OP<ExprT> > { \
135  public: \
136  \
137  typedef typename ExprT::value_type value_type; \
138  typedef typename ExprT::approx_type approx_type; \
139  typedef typename ExprT::expansion_type expansion_type; \
140  typedef typename ExprT::quad_expansion_type quad_expansion_type; \
141  typedef typename ExprT::storage_type storage_type; \
142  typedef typename ExprT::base_expr_type base_expr_type; \
143  \
144  static const int num_args = ExprT::num_args; \
145  \
146  Expr(const ExprT& expr_) : expr(expr_) {} \
147  \
148  std::string name() const { \
149  return std::string(#OPER) + std::string("(") + expr.name() + \
150  std::string(")"); \
151  } \
152  \
153  int size() const { \
154  if (expr.size() == 1) \
155  return 1; \
156  else \
157  return expansion()->size(); \
158  } \
159  \
160  const approx_type& getArg(int i) const { return expr.getArg(i); } \
161  \
162  bool has_nonconst_expansion() const { \
163  return expr.has_nonconst_expansion(); \
164  } \
165  \
166  Teuchos::RCP<expansion_type> expansion() const { \
167  return expr.expansion(); \
168  } \
169  \
170  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
171  return expr.quad_expansion(); \
172  } \
173  \
174  bool has_fast_access(int sz) const { return false; } \
175  \
176  int order() const { return size() == 0 ? 0 : 100; } \
177  \
178  value_type val() const { return OPER (expr.val()); } \
179  \
180  value_type fast_higher_order_coeff(int i) const { \
181  return value_type(0); \
182  } \
183  \
184  value_type higher_order_coeff(int i) const { \
185  return value_type(0); \
186  } \
187  \
188  template <int offset, typename tuple_type> \
189  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
190  return OPER (expr.template eval_sample<offset,tuple_type>(x)); \
191  } \
192  \
193  protected: \
194  \
195  const ExprT& expr; \
196  \
197  }; \
198  \
199  template <typename T> \
200  inline Expr< OP< Expr<T> > > \
201  OPNAME (const Expr<T>& expr) \
202  { \
203  typedef OP< Expr<T> > expr_t; \
204  \
205  return Expr<expr_t>(expr); \
206  } \
207  } \
208 }
209 
210 LINEAR_PCE_UNARYOP_MACRO(operator+, UnaryPlusOp, +)
212 
232 
233 #undef LINEAR_PCE_UNARYOP_MACRO
234 #undef NONLINEAR_PCE_UNARYOP_MACRO
235 
236 #define LINEAR_PCE_BINARYOP_MACRO(OPNAME,OP,OPER) \
237 namespace Sacado { \
238  namespace ETPCE { \
239  \
240  template <typename ExprT1, typename ExprT2> \
241  class OP {}; \
242  \
243  template <typename T1, typename T2> \
244  class Expr< OP< Expr<T1>, Expr<T2> > > { \
245  \
246  public: \
247  \
248  typedef Expr<T1> ExprT1; \
249  typedef Expr<T2> ExprT2; \
250  typedef typename ExprT1::value_type value_type_1; \
251  typedef typename ExprT2::value_type value_type_2; \
252  typedef typename Sacado::Promote<value_type_1, \
253  value_type_2>::type value_type; \
254  \
255  typedef typename ExprT1::approx_type approx_type; \
256  typedef typename ExprT1::expansion_type expansion_type; \
257  typedef typename ExprT1::quad_expansion_type quad_expansion_type; \
258  typedef typename ExprT1::storage_type storage_type; \
259  typedef typename ExprT1::base_expr_type base_expr_type; \
260  \
261  static const int num_args1 = ExprT1::num_args; \
262  static const int num_args2 = ExprT2::num_args; \
263  static const int num_args = num_args1 + num_args2; \
264  \
265  Expr(const ExprT1& expr1_, const ExprT2& expr2_) : \
266  expr1(expr1_), expr2(expr2_) {} \
267  \
268  std::string name() const { \
269  return expr1.name() + std::string(#OPER) + expr2.name(); \
270  } \
271  \
272  int size() const { \
273  int sz1 = expr1.size(), sz2 = expr2.size(); \
274  return sz1 > sz2 ? sz1 : sz2; \
275  } \
276  \
277  const approx_type& getArg(int i) const { \
278  if (i < num_args1) \
279  return expr1.getArg(i); \
280  else \
281  return expr2.getArg(i-num_args1); \
282  } \
283  \
284  bool has_nonconst_expansion() const { \
285  return expr1.has_nonconst_expansion() || \
286  expr2.has_nonconst_expansion(); \
287  } \
288  \
289  Teuchos::RCP<expansion_type> expansion() const { \
290  return expr1.has_nonconst_expansion() ? expr1.expansion() : \
291  expr2.expansion(); \
292  } \
293  \
294  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
295  return expr1.quad_expansion() != Teuchos::null ? \
296  expr1.quad_expansion() : \
297  expr2.quad_expansion(); \
298  } \
299  \
300  bool has_fast_access(int sz) const { \
301  return expr1.has_fast_access(sz) && expr2.has_fast_access(sz); \
302  } \
303  \
304  int order() const { \
305  int o1 = expr1.order(), o2 = expr2.order(); \
306  return o1 > o2 ? o1 : o2; \
307  } \
308  \
309  value_type val() const { \
310  return expr1.val() OPER expr2.val(); \
311  } \
312  \
313  value_type fast_higher_order_coeff(int i) const { \
314  return expr1.fast_higher_order_coeff(i) OPER \
315  expr2.fast_higher_order_coeff(i); \
316  } \
317  \
318  value_type higher_order_coeff(int i) const { \
319  return expr1.higher_order_coeff(i) OPER \
320  expr2.higher_order_coeff(i); \
321  } \
322  \
323  template <int offset, typename tuple_type> \
324  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
325  return expr1.template eval_sample<offset,tuple_type>(x) OPER \
326  expr2.template eval_sample<offset+num_args1,tuple_type>(x); \
327  } \
328  \
329  protected: \
330  \
331  const ExprT1& expr1; \
332  const ExprT2& expr2; \
333  \
334  }; \
335  \
336  template <typename T1> \
337  class Expr< OP< Expr<T1>, typename Expr<T1>::value_type> > { \
338  \
339  public: \
340  \
341  typedef Expr<T1> ExprT1; \
342  typedef typename ExprT1::value_type value_type; \
343  typedef typename ExprT1::value_type ConstT; \
344  \
345  typedef typename ExprT1::approx_type approx_type; \
346  typedef typename ExprT1::expansion_type expansion_type; \
347  typedef typename ExprT1::quad_expansion_type quad_expansion_type; \
348  typedef typename ExprT1::storage_type storage_type; \
349  typedef typename ExprT1::base_expr_type base_expr_type; \
350  \
351  static const int num_args = ExprT1::num_args; \
352  \
353  Expr(const ExprT1& expr1_, const ConstT& c_) : \
354  expr1(expr1_), c(c_) {} \
355  \
356  std::string name() const { \
357  return expr1.name() + std::string(#OPER) + std::string("c"); \
358  } \
359  \
360  int size() const { return expr1.size(); } \
361  \
362  const approx_type& getArg(int i) const { \
363  return expr1.getArg(i); \
364  } \
365  \
366  bool has_nonconst_expansion() const { \
367  return expr1.has_nonconst_expansion(); \
368  } \
369  \
370  Teuchos::RCP<expansion_type> expansion() const { \
371  return expr1.expansion(); \
372  } \
373  \
374  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
375  return expr1.quad_expansion(); \
376  } \
377  \
378  bool has_fast_access(int sz) const { return expr1.has_fast_access(sz); } \
379  \
380  int order() const { return expr1.order(); } \
381  \
382  value_type val() const { \
383  return expr1.val() OPER c; \
384  } \
385  \
386  value_type fast_higher_order_coeff(int i) const { \
387  return expr1.fast_higher_order_coeff(i); \
388  } \
389  \
390  value_type higher_order_coeff(int i) const { \
391  return expr1.higher_order_coeff(i); \
392  } \
393  \
394  template <int offset, typename tuple_type> \
395  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
396  return expr1.template eval_sample<offset,tuple_type>(x) OPER c; \
397  } \
398  \
399  protected: \
400  \
401  const ExprT1& expr1; \
402  const ConstT& c; \
403  }; \
404  \
405  template <typename T2> \
406  class Expr< OP< typename Expr<T2>::value_type, Expr<T2> > > { \
407  \
408  public: \
409  \
410  typedef Expr<T2> ExprT2; \
411  typedef typename ExprT2::value_type value_type; \
412  typedef typename ExprT2::value_type ConstT; \
413  \
414  typedef typename ExprT2::approx_type approx_type; \
415  typedef typename ExprT2::expansion_type expansion_type; \
416  typedef typename ExprT2::quad_expansion_type quad_expansion_type; \
417  typedef typename ExprT2::storage_type storage_type; \
418  typedef typename ExprT2::base_expr_type base_expr_type; \
419  \
420  static const int num_args = ExprT2::num_args; \
421  \
422  Expr(const ConstT& c_, const ExprT2& expr2_) : \
423  c(c_), expr2(expr2_) {} \
424  \
425  std::string name() const { \
426  return std::string("c") + std::string(#OPER) + expr2.name(); \
427  } \
428  \
429  int size() const { return expr2.size(); } \
430  \
431  const approx_type& getArg(int i) const { return expr2.getArg(i); } \
432  \
433  bool has_nonconst_expansion() const { \
434  return expr2.has_nonconst_expansion(); \
435  } \
436  \
437  Teuchos::RCP<expansion_type> expansion() const { \
438  return expr2.expansion(); \
439  } \
440  \
441  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
442  return expr2.quad_expansion(); \
443  } \
444  \
445  bool has_fast_access(int sz) const { return expr2.has_fast_access(sz); } \
446  \
447  int order() const { return expr2.order(); } \
448  \
449  value_type val() const { \
450  return c OPER expr2.val(); \
451  } \
452  \
453  value_type fast_higher_order_coeff(int i) const { \
454  return OPER expr2.fast_higher_order_coeff(i); \
455  } \
456  \
457  value_type higher_order_coeff(int i) const { \
458  return OPER expr2.higher_order_coeff(i); \
459  } \
460  \
461  template <int offset, typename tuple_type> \
462  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
463  return c OPER expr2.template eval_sample<offset,tuple_type>(x); \
464  } \
465  \
466  protected: \
467  \
468  const ConstT& c; \
469  const ExprT2& expr2; \
470  }; \
471  \
472  template <typename T1, typename T2> \
473  inline Expr< OP< Expr<T1>, Expr<T2> > > \
474  OPNAME (const Expr<T1>& expr1, const Expr<T2>& expr2) \
475  { \
476  typedef OP< Expr<T1>, Expr<T2> > expr_t; \
477  \
478  return Expr<expr_t>(expr1, expr2); \
479  } \
480  \
481  template <typename T> \
482  inline Expr< OP< Expr<T>, Expr<T> > > \
483  OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
484  { \
485  typedef OP< Expr<T>, Expr<T> > expr_t; \
486  \
487  return Expr<expr_t>(expr1, expr2); \
488  } \
489  \
490  template <typename T> \
491  inline Expr< OP< typename Expr<T>::value_type, Expr<T> > > \
492  OPNAME (const typename Expr<T>::value_type& c, \
493  const Expr<T>& expr) \
494  { \
495  typedef typename Expr<T>::value_type ConstT; \
496  typedef OP< ConstT, Expr<T> > expr_t; \
497  \
498  return Expr<expr_t>(c, expr); \
499  } \
500  \
501  template <typename T> \
502  inline Expr< OP< Expr<T>, typename Expr<T>::value_type > > \
503  OPNAME (const Expr<T>& expr, \
504  const typename Expr<T>::value_type& c) \
505  { \
506  typedef typename Expr<T>::value_type ConstT; \
507  typedef OP< Expr<T>, ConstT > expr_t; \
508  \
509  return Expr<expr_t>(expr, c); \
510  } \
511  } \
512 }
513 
514 #define NONLINEAR_PCE_BINARYOP_MACRO(OPNAME,OP,OPER) \
515 namespace Sacado { \
516  namespace ETPCE { \
517  \
518  template <typename ExprT1, typename ExprT2> \
519  class OP {}; \
520  \
521  template <typename T1, typename T2> \
522  class Expr< OP< Expr<T1>, Expr<T2> > > { \
523  \
524  public: \
525  \
526  typedef Expr<T1> ExprT1; \
527  typedef Expr<T2> ExprT2; \
528  typedef typename ExprT1::value_type value_type_1; \
529  typedef typename ExprT2::value_type value_type_2; \
530  typedef typename Sacado::Promote<value_type_1, \
531  value_type_2>::type value_type; \
532  \
533  typedef typename ExprT1::approx_type approx_type; \
534  typedef typename ExprT1::expansion_type expansion_type; \
535  typedef typename ExprT1::quad_expansion_type quad_expansion_type; \
536  typedef typename ExprT1::storage_type storage_type; \
537  typedef typename ExprT1::base_expr_type base_expr_type; \
538  \
539  static const int num_args1 = ExprT1::num_args; \
540  static const int num_args2 = ExprT2::num_args; \
541  static const int num_args = num_args1 + num_args2; \
542  \
543  Expr(const ExprT1& expr1_, const ExprT2& expr2_) : \
544  expr1(expr1_), expr2(expr2_) {} \
545  \
546  std::string name() const { \
547  return std::string(#OPER) + std::string("(") + expr1.name() + \
548  std::string(",") + expr2.name() + std::string(")"); \
549  } \
550  \
551  int size() const { \
552  if (expr1.size() == 1 && expr2.size() == 1) \
553  return 1; \
554  else \
555  return expansion()->size(); \
556  } \
557  \
558  const approx_type& getArg(int i) const { \
559  if (i < num_args1) \
560  return expr1.getArg(i); \
561  else \
562  return expr2.getArg(i-num_args1); \
563  } \
564  \
565  bool has_nonconst_expansion() const { \
566  return expr1.has_nonconst_expansion() || \
567  expr2.has_nonconst_expansion(); \
568  } \
569  \
570  Teuchos::RCP<expansion_type> expansion() const { \
571  return expr1.has_nonconst_expansion() ? expr1.expansion() : \
572  expr2.expansion(); \
573  } \
574  \
575  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
576  return expr1.quad_expansion() != Teuchos::null ? \
577  expr1.quad_expansion() : \
578  expr2.quad_expansion(); \
579  } \
580  \
581  bool has_fast_access(int sz) const { return false; } \
582  \
583  int order() const { return size() == 0 ? 0 : 100; } \
584  \
585  value_type val() const { \
586  return OPER (expr1.val(), expr2.val()); \
587  } \
588  \
589  value_type fast_higher_order_coeff(int i) const { \
590  return value_type(0); \
591  } \
592  \
593  value_type higher_order_coeff(int i) const { \
594  return value_type(0); \
595  } \
596  \
597  template <int offset, typename tuple_type> \
598  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
599  return OPER (expr1.template eval_sample<offset,tuple_type>(x), \
600  expr2.template eval_sample<offset+num_args1,tuple_type>(x)); \
601  } \
602  \
603  protected: \
604  \
605  const ExprT1& expr1; \
606  const ExprT2& expr2; \
607  \
608  }; \
609  \
610  template <typename T1> \
611  class Expr< OP< Expr<T1>, typename Expr<T1>::value_type> > { \
612  \
613  public: \
614  \
615  typedef Expr<T1> ExprT1; \
616  typedef typename ExprT1::value_type value_type; \
617  typedef typename ExprT1::value_type ConstT; \
618  \
619  typedef typename ExprT1::approx_type approx_type; \
620  typedef typename ExprT1::expansion_type expansion_type; \
621  typedef typename ExprT1::quad_expansion_type quad_expansion_type; \
622  typedef typename ExprT1::storage_type storage_type; \
623  typedef typename ExprT1::base_expr_type base_expr_type; \
624  \
625  static const int num_args = ExprT1::num_args; \
626  \
627  Expr(const ExprT1& expr1_, const ConstT& c_) : \
628  expr1(expr1_), c(c_) {} \
629  \
630  std::string name() const { \
631  return std::string(#OPER) + std::string("(") + expr1.name() + \
632  std::string(",c)"); \
633  } \
634  \
635  int size() const { \
636  if (expr1.size() == 1) \
637  return 1; \
638  else \
639  return expansion()->size(); \
640  } \
641  \
642  const approx_type& getArg(int i) const { \
643  return expr1.getArg(i); \
644  } \
645  \
646  bool has_nonconst_expansion() const { \
647  return expr1.has_nonconst_expansion(); \
648  } \
649  \
650  Teuchos::RCP<expansion_type> expansion() const { \
651  return expr1.expansion(); \
652  } \
653  \
654  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
655  return expr1.quad_expansion(); \
656  } \
657  \
658  bool has_fast_access(int sz) const { return false; } \
659  \
660  int order() const { return size() == 0 ? 0 : 100; } \
661  \
662  value_type val() const { \
663  return OPER (expr1.val(), c); \
664  } \
665  \
666  value_type fast_higher_order_coeff(int i) const { \
667  return value_type(0); \
668  } \
669  \
670  value_type higher_order_coeff(int i) const { \
671  return value_type(0); \
672  } \
673  \
674  template <int offset, typename tuple_type> \
675  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
676  return OPER (expr1.template eval_sample<offset,tuple_type>(x), c); \
677  } \
678  \
679  protected: \
680  \
681  const ExprT1& expr1; \
682  const ConstT& c; \
683  }; \
684  \
685  template <typename T2> \
686  class Expr< OP< typename Expr<T2>::value_type, Expr<T2> > > { \
687  \
688  public: \
689  \
690  typedef Expr<T2> ExprT2; \
691  typedef typename ExprT2::value_type value_type; \
692  typedef typename ExprT2::value_type ConstT; \
693  \
694  typedef typename ExprT2::approx_type approx_type; \
695  typedef typename ExprT2::expansion_type expansion_type; \
696  typedef typename ExprT2::quad_expansion_type quad_expansion_type; \
697  typedef typename ExprT2::storage_type storage_type; \
698  typedef typename ExprT2::base_expr_type base_expr_type; \
699  \
700  static const int num_args = ExprT2::num_args; \
701  \
702  Expr(const ConstT& c_, const ExprT2& expr2_) : \
703  c(c_), expr2(expr2_) {} \
704  \
705  std::string name() const { \
706  return std::string(#OPER) + std::string("(c,") + \
707  expr2.name() + std::string(")"); \
708  } \
709  \
710  int size() const { \
711  if (expr2.size() == 1) \
712  return 1; \
713  else \
714  return expansion()->size(); \
715  } \
716  \
717  const approx_type& getArg(int i) const { return expr2.getArg(i); } \
718  \
719  Teuchos::RCP<expansion_type> expansion() const { \
720  return expr2.expansion(); \
721  } \
722  \
723  bool has_nonconst_expansion() const { \
724  return expr2.has_nonconst_expansion(); \
725  } \
726  \
727  Teuchos::RCP<quad_expansion_type> quad_expansion() const { \
728  return expr2.quad_expansion(); \
729  } \
730  \
731  bool has_fast_access(int sz) const { return false; } \
732  \
733  int order() const { return size() == 0 ? 0 : 100; } \
734  \
735  value_type val() const { \
736  return OPER (c, expr2.val()); \
737  } \
738  \
739  value_type fast_higher_order_coeff(int i) const { \
740  return value_type(0); \
741  } \
742  \
743  value_type higher_order_coeff(int i) const { \
744  return value_type(0); \
745  } \
746  \
747  template <int offset, typename tuple_type> \
748  KERNEL_PREFIX value_type eval_sample(tuple_type x) const { \
749  return OPER (c, expr2.template eval_sample<offset,tuple_type>(x)); \
750  } \
751  \
752  protected: \
753  \
754  const ConstT& c; \
755  const ExprT2& expr2; \
756  }; \
757  \
758  template <typename T1, typename T2> \
759  inline Expr< OP< Expr<T1>, Expr<T2> > > \
760  OPNAME (const Expr<T1>& expr1, const Expr<T2>& expr2) \
761  { \
762  typedef OP< Expr<T1>, Expr<T2> > expr_t; \
763  \
764  return Expr<expr_t>(expr1, expr2); \
765  } \
766  \
767  template <typename T> \
768  inline Expr< OP< Expr<T>, Expr<T> > > \
769  OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
770  { \
771  typedef OP< Expr<T>, Expr<T> > expr_t; \
772  \
773  return Expr<expr_t>(expr1, expr2); \
774  } \
775  \
776  template <typename T> \
777  inline Expr< OP< typename Expr<T>::value_type, Expr<T> > > \
778  OPNAME (const typename Expr<T>::value_type& c, \
779  const Expr<T>& expr) \
780  { \
781  typedef typename Expr<T>::value_type ConstT; \
782  typedef OP< ConstT, Expr<T> > expr_t; \
783  \
784  return Expr<expr_t>(c, expr); \
785  } \
786  \
787  template <typename T> \
788  inline Expr< OP< Expr<T>, typename Expr<T>::value_type > > \
789  OPNAME (const Expr<T>& expr, \
790  const typename Expr<T>::value_type& c) \
791  { \
792  typedef typename Expr<T>::value_type ConstT; \
793  typedef OP< Expr<T>, ConstT > expr_t; \
794  \
795  return Expr<expr_t>(expr, c); \
796  } \
797  } \
798 }
799 
800 LINEAR_PCE_BINARYOP_MACRO(operator+, AdditionOp, +)
802 
807 
808 #undef LINEAR_PCE_BINARYOP_MACRO
809 #undef NONLINEAR_PCE_BINARYOP_MACRO
810 
811 //-------------------------- Multiplication Operator -----------------------
812 
813 namespace Sacado {
814  namespace ETPCE {
815 
816  template <typename ExprT1, typename ExprT2>
818 
819  template <typename T1, typename T2>
820  class Expr< MultiplicationOp< Expr<T1>, Expr<T2> > > {
821 
822  public:
823 
824  typedef Expr<T1> ExprT1;
825  typedef Expr<T2> ExprT2;
828  typedef typename Sacado::Promote<value_type_1,
830 
831  typedef typename ExprT1::approx_type approx_type;
832  typedef typename ExprT1::expansion_type expansion_type;
833  typedef typename ExprT1::quad_expansion_type quad_expansion_type;
835  typedef typename ExprT1::base_expr_type base_expr_type;
836 
837  static const int num_args1 = ExprT1::num_args;
838  static const int num_args2 = ExprT2::num_args;
839  static const int num_args = num_args1 + num_args2;
840 
841  Expr(const ExprT1& expr1_, const ExprT2& expr2_) :
842  expr1(expr1_), expr2(expr2_) {}
843 
844  std::string name() const {
845  return expr1.name() + std::string("*") + expr2.name();
846  }
847 
848  int size() const {
849  int sz1 = expr1.size();
850  int sz2 = expr2.size();
851  if (sz1 > 1 && sz2 > 1)
852  return expansion()->size();
853  else
854  return sz1*sz2;
855  }
856 
857  const approx_type& getArg(int i) const {
858  if (i < num_args1)
859  return expr1.getArg(i);
860  else
861  return expr2.getArg(i-num_args1);
862  }
863 
864  bool has_nonconst_expansion() const {
865  return expr1.has_nonconst_expansion() || expr2.has_nonconst_expansion();
866  }
867 
868  Teuchos::RCP<expansion_type> expansion() const {
869  return expr1.has_nonconst_expansion() ? expr1.expansion() :
870  expr2.expansion();
871  }
872 
873  Teuchos::RCP<quad_expansion_type> quad_expansion() const {
874  return expr1.quad_expansion() != Teuchos::null ?
875  expr1.quad_expansion() :
876  expr2.quad_expansion();
877  }
878 
879  bool has_fast_access(int sz) const {
880  return expr1.has_fast_access(sz) && expr2.has_fast_access(sz);
881  }
882 
883  int order() const { return expr1.order() + expr2.order(); }
884 
885  value_type val() const {
886  if (order() == 0)
887  return expr1.val() * expr2.val();
888  else
889  return quad_expansion()->compute_times_coeff(0,expr1,expr2);
890  }
891 
893  return quad_expansion()->fast_compute_times_coeff(i,expr1,expr2);
894  }
895 
897  return quad_expansion()->compute_times_coeff(i,expr1,expr2);
898  }
899 
900  template <int offset, typename tuple_type>
901  KERNEL_PREFIX value_type eval_sample(tuple_type x) const {
902  return expr1.template eval_sample<offset,tuple_type>(x) *
903  expr2.template eval_sample<offset+num_args1,tuple_type>(x);
904  }
905 
906  protected:
907 
908  const ExprT1& expr1;
909  const ExprT2& expr2;
910 
911  };
912 
913  template <typename T1>
914  class Expr< MultiplicationOp< Expr<T1>, typename Expr<T1>::value_type> > {
915 
916  public:
917 
918  typedef Expr<T1> ExprT1;
919  typedef typename ExprT1::value_type value_type;
920  typedef typename ExprT1::value_type ConstT;
921 
922  typedef typename ExprT1::approx_type approx_type;
923  typedef typename ExprT1::expansion_type expansion_type;
924  typedef typename ExprT1::quad_expansion_type quad_expansion_type;
926  typedef typename ExprT1::base_expr_type base_expr_type;
927 
928  static const int num_args = ExprT1::num_args;
929 
930  Expr(const ExprT1& expr1_, const ConstT& c_) :
931  expr1(expr1_), c(c_) {}
932 
933  std::string name() const {
934  return expr1.name() + std::string("*c");
935  }
936 
937  int size() const { return expr1.size(); }
938 
939  const approx_type& getArg(int i) const {
940  return expr1.getArg(i);
941  }
942 
943  bool has_nonconst_expansion() const {
944  return expr1.has_nonconst_expansion();
945  }
946 
947  Teuchos::RCP<expansion_type> expansion() const {
948  return expr1.expansion();
949  }
950 
951  Teuchos::RCP<quad_expansion_type> quad_expansion() const {
952  return expr1.quad_expansion();
953  }
954 
955  bool has_fast_access(int sz) const { return expr1.has_fast_access(sz); }
956 
957  int order() const { return expr1.order(); }
958 
959  value_type val() const {
960  return expr1.val() * c;
961  }
962 
964  return expr1.fast_higher_order_coeff(i) * c;
965  }
966 
968  return expr1.higher_order_coeff(i) * c;
969  }
970 
971  template <int offset, typename tuple_type>
972  KERNEL_PREFIX value_type eval_sample(tuple_type x) const {
973  return expr1.template eval_sample<offset,tuple_type>(x) * c;
974  }
975 
976  protected:
977 
978  const ExprT1& expr1;
979  const ConstT& c;
980  };
981 
982  template <typename T2>
983  class Expr< MultiplicationOp< typename Expr<T2>::value_type, Expr<T2> > > {
984 
985  public:
986 
987  typedef Expr<T2> ExprT2;
988  typedef typename ExprT2::value_type value_type;
989  typedef typename ExprT2::value_type ConstT;
990 
991  typedef typename ExprT2::approx_type approx_type;
992  typedef typename ExprT2::expansion_type expansion_type;
993  typedef typename ExprT2::quad_expansion_type quad_expansion_type;
995  typedef typename ExprT2::base_expr_type base_expr_type;
996 
997  static const int num_args = ExprT2::num_args;
998 
999  Expr(const ConstT& c_, const ExprT2& expr2_) :
1000  c(c_), expr2(expr2_) {}
1001 
1002  std::string name() const {
1003  return std::string("c*") + expr2.name();
1004  }
1005 
1006  int size() const { return expr2.size(); }
1007 
1008  const approx_type& getArg(int i) const { return expr2.getArg(i); }
1009 
1010  bool has_nonconst_expansion() const {
1011  return expr2.has_nonconst_expansion();
1012  }
1013 
1014  Teuchos::RCP<expansion_type> expansion() const {
1015  return expr2.expansion();
1016  }
1017 
1018  Teuchos::RCP<quad_expansion_type> quad_expansion() const {
1019  return expr2.quad_expansion();
1020  }
1021 
1022  bool has_fast_access(int sz) const { return expr2.has_fast_access(sz); }
1023 
1024  int order() const { return expr2.order(); }
1025 
1026  value_type val() const {
1027  return c * expr2.val();
1028  }
1029 
1031  return c * expr2.fast_higher_order_coeff(i);
1032  }
1033 
1035  return c * expr2.higher_order_coeff(i);
1036  }
1037 
1038  template <int offset, typename tuple_type>
1039  KERNEL_PREFIX value_type eval_sample(tuple_type x) const {
1040  return c * expr2.template eval_sample<offset,tuple_type>(x);
1041  }
1042 
1043  protected:
1044 
1045  const ConstT& c;
1046  const ExprT2& expr2;
1047  };
1048 
1049  template <typename T1, typename T2>
1051  operator* (const Expr<T1>& expr1, const Expr<T2>& expr2)
1052  {
1053  typedef MultiplicationOp< Expr<T1>, Expr<T2> > expr_t;
1054 
1055  return Expr<expr_t>(expr1, expr2);
1056  }
1057 
1058  template <typename T>
1059  inline Expr< MultiplicationOp< Expr<T>, Expr<T> > >
1060  operator* (const Expr<T>& expr1, const Expr<T>& expr2)
1061  {
1062  typedef MultiplicationOp< Expr<T>, Expr<T> > expr_t;
1063 
1064  return Expr<expr_t>(expr1, expr2);
1065  }
1066 
1067  template <typename T>
1069  operator* (const typename Expr<T>::value_type& c,
1070  const Expr<T>& expr)
1071  {
1072  typedef typename Expr<T>::value_type ConstT;
1073  typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
1074 
1075  return Expr<expr_t>(c, expr);
1076  }
1077 
1078  template <typename T>
1079  inline Expr< MultiplicationOp< Expr<T>, typename Expr<T>::value_type > >
1080  operator* (const Expr<T>& expr,
1081  const typename Expr<T>::value_type& c)
1082  {
1083  typedef typename Expr<T>::value_type ConstT;
1084  typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
1085 
1086  return Expr<expr_t>(expr, c);
1087  }
1088  }
1089 }
1090 
1091 //-------------------------- Division Operator -----------------------
1092 
1093 namespace Sacado {
1094  namespace ETPCE {
1095 
1096  template <typename ExprT1, typename ExprT2>
1097  class DivisionOp {};
1098 
1099  template <typename T1, typename T2>
1100  class Expr< DivisionOp< Expr<T1>, Expr<T2> > > {
1101 
1102  public:
1103 
1104  typedef Expr<T1> ExprT1;
1105  typedef Expr<T2> ExprT2;
1108  typedef typename Sacado::Promote<value_type_1,
1110 
1111  typedef typename ExprT1::approx_type approx_type;
1112  typedef typename ExprT1::expansion_type expansion_type;
1113  typedef typename ExprT1::quad_expansion_type quad_expansion_type;
1115  typedef typename ExprT1::base_expr_type base_expr_type;
1116 
1117  static const int num_args1 = ExprT1::num_args;
1118  static const int num_args2 = ExprT2::num_args;
1119  static const int num_args = num_args1 + num_args2;
1120 
1121  Expr(const ExprT1& expr1_, const ExprT2& expr2_) :
1122  expr1(expr1_), expr2(expr2_) {}
1123 
1124  std::string name() const {
1125  return expr1.name() + std::string("/") + expr2.name();
1126  }
1127 
1128  int size() const {
1129  if (expr2.size() == 1)
1130  return expr1.size();
1131  else
1132  return expansion()->size();
1133  }
1134 
1135  const approx_type& getArg(int i) const {
1136  if (i < num_args1)
1137  return expr1.getArg(i);
1138  else
1139  return expr2.getArg(i-num_args1);
1140  }
1141 
1142  bool has_nonconst_expansion() const {
1143  return expr1.has_nonconst_expansion() || expr2.has_nonconst_expansion();
1144  }
1145 
1146  Teuchos::RCP<expansion_type> expansion() const {
1147  return expr1.has_nonconst_expansion() ? expr1.expansion() :
1148  expr2.expansion();
1149  }
1150 
1151  Teuchos::RCP<quad_expansion_type> quad_expansion() const {
1152  return expr1.quad_expansion() != Teuchos::null ?
1153  expr1.quad_expansion() :
1154  expr2.quad_expansion();
1155  }
1156 
1157  bool has_fast_access(int sz) const {
1158  return expr1.has_fast_access(sz) && (expr2.order() == 0);
1159  }
1160 
1161  int order() const { return expr2.order() == 0 ? expr1.order() : 100; }
1162 
1163  value_type val() const {
1164  return expr1.val() / expr2.val();
1165  }
1166 
1168  return expr1.fast_higher_order_coeff(i) / expr2.val();
1169  }
1170 
1172  return expr1.higher_order_coeff(i) / expr2.val();
1173  }
1174 
1175  template <int offset, typename tuple_type>
1176  KERNEL_PREFIX value_type eval_sample(tuple_type x) const {
1177  return expr1.template eval_sample<offset,tuple_type>(x) /
1178  expr2.template eval_sample<offset+num_args1,tuple_type>(x);
1179  }
1180 
1181  protected:
1182 
1183  const ExprT1& expr1;
1184  const ExprT2& expr2;
1185 
1186  };
1187 
1188  template <typename T1>
1189  class Expr< DivisionOp< Expr<T1>, typename Expr<T1>::value_type> > {
1190 
1191  public:
1192 
1193  typedef Expr<T1> ExprT1;
1194  typedef typename ExprT1::value_type value_type;
1195  typedef typename ExprT1::value_type ConstT;
1196 
1197  typedef typename ExprT1::approx_type approx_type;
1198  typedef typename ExprT1::expansion_type expansion_type;
1199  typedef typename ExprT1::quad_expansion_type quad_expansion_type;
1201  typedef typename ExprT1::base_expr_type base_expr_type;
1202 
1203  static const int num_args = ExprT1::num_args;
1204 
1205  Expr(const ExprT1& expr1_, const ConstT& c_) :
1206  expr1(expr1_), c(c_) {}
1207 
1208  std::string name() const {
1209  return expr1.name() + std::string("/c");
1210  }
1211 
1212  int size() const { return expr1.size(); }
1213 
1214  const approx_type& getArg(int i) const {
1215  return expr1.getArg(i);
1216  }
1217 
1218  bool has_nonconst_expansion() const {
1219  return expr1.has_nonconst_expansion();
1220  }
1221 
1222  Teuchos::RCP<expansion_type> expansion() const {
1223  return expr1.expansion();
1224  }
1225 
1226  Teuchos::RCP<quad_expansion_type> quad_expansion() const {
1227  return expr1.quad_expansion();
1228  }
1229 
1230  bool has_fast_access(int sz) const { return expr1.has_fast_access(sz); }
1231 
1232  int order() const { return expr1.order(); }
1233 
1234  value_type val() const {
1235  return expr1.val() / c;
1236  }
1237 
1239  return expr1.fast_higher_order_coeff(i) / c;
1240  }
1241 
1243  return expr1.higher_order_coeff(i) / c;
1244  }
1245 
1246  template <int offset, typename tuple_type>
1247  KERNEL_PREFIX value_type eval_sample(tuple_type x) const {
1248  return expr1.template eval_sample<offset,tuple_type>(x) / c;
1249  }
1250 
1251  protected:
1252 
1253  const ExprT1& expr1;
1254  const ConstT& c;
1255  };
1256 
1257  template <typename T2>
1258  class Expr< DivisionOp< typename Expr<T2>::value_type, Expr<T2> > > {
1259 
1260  public:
1261 
1262  typedef Expr<T2> ExprT2;
1263  typedef typename ExprT2::value_type value_type;
1264  typedef typename ExprT2::value_type ConstT;
1265 
1266  typedef typename ExprT2::approx_type approx_type;
1267  typedef typename ExprT2::expansion_type expansion_type;
1268  typedef typename ExprT2::quad_expansion_type quad_expansion_type;
1270  typedef typename ExprT2::base_expr_type base_expr_type;
1271 
1272  static const int num_args = ExprT2::num_args;
1273 
1274  Expr(const ConstT& c_, const ExprT2& expr2_) :
1275  c(c_), expr2(expr2_) {}
1276 
1277  std::string name() const {
1278  return std::string("c/") + expr2.name();
1279  }
1280 
1281  int size() const {
1282  if (expr2.size() == 1)
1283  return 1;
1284  else
1285  return expansion()->size();
1286  }
1287 
1288  const approx_type& getArg(int i) const { return expr2.getArg(i); }
1289 
1290  bool has_nonconst_expansion() const {
1291  return expr2.has_nonconst_expansion();
1292  }
1293 
1294  Teuchos::RCP<expansion_type> expansion() const {
1295  return expr2.expansion();
1296  }
1297 
1298  Teuchos::RCP<quad_expansion_type> quad_expansion() const {
1299  return expr2.quad_expansion();
1300  }
1301 
1302  bool has_fast_access(int sz) const { return false; }
1303 
1304  int order() const { return expr2.order() == 0 ? 0 : 100; }
1305 
1306  value_type val() const {
1307  return c / expr2.val();
1308  }
1309 
1311  return value_type(0);
1312  }
1313 
1315  return value_type(0);
1316  }
1317 
1318  template <int offset, typename tuple_type>
1319  KERNEL_PREFIX value_type eval_sample(tuple_type x) const {
1320  return c / expr2.template eval_sample<offset,tuple_type>(x);
1321  }
1322 
1323  protected:
1324 
1325  const ConstT& c;
1326  const ExprT2& expr2;
1327  };
1328 
1329  template <typename T1, typename T2>
1331  operator/ (const Expr<T1>& expr1, const Expr<T2>& expr2)
1332  {
1333  typedef DivisionOp< Expr<T1>, Expr<T2> > expr_t;
1334 
1335  return Expr<expr_t>(expr1, expr2);
1336  }
1337 
1338  template <typename T>
1339  inline Expr< DivisionOp< Expr<T>, Expr<T> > >
1340  operator/ (const Expr<T>& expr1, const Expr<T>& expr2)
1341  {
1342  typedef DivisionOp< Expr<T>, Expr<T> > expr_t;
1343 
1344  return Expr<expr_t>(expr1, expr2);
1345  }
1346 
1347  template <typename T>
1349  operator/ (const typename Expr<T>::value_type& c,
1350  const Expr<T>& expr)
1351  {
1352  typedef typename Expr<T>::value_type ConstT;
1353  typedef DivisionOp< ConstT, Expr<T> > expr_t;
1354 
1355  return Expr<expr_t>(c, expr);
1356  }
1357 
1358  template <typename T>
1359  inline Expr< DivisionOp< Expr<T>, typename Expr<T>::value_type > >
1360  operator/ (const Expr<T>& expr,
1361  const typename Expr<T>::value_type& c)
1362  {
1363  typedef typename Expr<T>::value_type ConstT;
1364  typedef DivisionOp< Expr<T>, ConstT > expr_t;
1365 
1366  return Expr<expr_t>(expr, c);
1367  }
1368  }
1369 }
1370 
1371 //-------------------------- Relational Operators -----------------------
1372 
1373 #define PCE_RELOP_MACRO(OP) \
1374 namespace Sacado { \
1375  namespace ETPCE { \
1376  template <typename ExprT1, typename ExprT2> \
1377  inline bool \
1378  operator OP (const Expr<ExprT1>& expr1, \
1379  const Expr<ExprT2>& expr2) \
1380  { \
1381  return expr1.val() OP expr2.val(); \
1382  } \
1383  \
1384  template <typename ExprT2> \
1385  inline bool \
1386  operator OP (const typename Expr<ExprT2>::value_type& a, \
1387  const Expr<ExprT2>& expr2) \
1388  { \
1389  return a OP expr2.val(); \
1390  } \
1391  \
1392  template <typename ExprT1> \
1393  inline bool \
1394  operator OP (const Expr<ExprT1>& expr1, \
1395  const typename Expr<ExprT1>::value_type& b) \
1396  { \
1397  return expr1.val() OP b; \
1398  } \
1399  } \
1400 }
1401 
1402 PCE_RELOP_MACRO(==)
1403 PCE_RELOP_MACRO(!=)
1404 PCE_RELOP_MACRO(<)
1405 PCE_RELOP_MACRO(>)
1406 PCE_RELOP_MACRO(<=)
1407 PCE_RELOP_MACRO(>=)
1408 PCE_RELOP_MACRO(<<=)
1409 PCE_RELOP_MACRO(>>=)
1410 PCE_RELOP_MACRO(&)
1411 PCE_RELOP_MACRO(|)
1412 
1413 #undef PCE_RELOP_MACRO
1414 
1415 namespace Sacado {
1416 
1417  namespace ETPCE {
1418 
1419  template <typename ExprT>
1420  inline bool operator ! (const Expr<ExprT>& expr)
1421  {
1422  return ! expr.val();
1423  }
1424 
1425  } // namespace ETPCE
1426 
1427 } // namespace Sacado
1428 
1429 //-------------------------- Boolean Operators -----------------------
1430 namespace Sacado {
1431 
1432  namespace ETPCE {
1433 
1434  template <typename ExprT>
1435  bool toBool(const Expr<ExprT>& x) {
1436  bool is_zero = true;
1437  for (int i=0; i<x.size(); i++)
1438  is_zero = is_zero && (x.coeff(i) == 0.0);
1439  return !is_zero;
1440  }
1441 
1442  } // namespace ETPCE
1443 
1444 } // namespace Sacado
1445 
1446 #define PCE_BOOL_MACRO(OP) \
1447 namespace Sacado { \
1448  namespace ETPCE { \
1449  template <typename ExprT1, typename ExprT2> \
1450  inline bool \
1451  operator OP (const Expr<ExprT1>& expr1, \
1452  const Expr<ExprT2>& expr2) \
1453  { \
1454  return toBool(expr1) OP toBool(expr2); \
1455  } \
1456  \
1457  template <typename ExprT2> \
1458  inline bool \
1459  operator OP (const typename Expr<ExprT2>::value_type& a, \
1460  const Expr<ExprT2>& expr2) \
1461  { \
1462  return a OP toBool(expr2); \
1463  } \
1464  \
1465  template <typename ExprT1> \
1466  inline bool \
1467  operator OP (const Expr<ExprT1>& expr1, \
1468  const typename Expr<ExprT1>::value_type& b) \
1469  { \
1470  return toBool(expr1) OP b; \
1471  } \
1472  } \
1473 }
1474 
1475 PCE_BOOL_MACRO(&&)
1476 PCE_BOOL_MACRO(||)
1477 
1478 #undef PCE_BOOL_MACRO
1479 
1480 //-------------------------- I/O Operators -----------------------
1481 
1482 namespace Sacado {
1483 
1484  namespace ETPCE {
1485 
1486  template <typename ExprT>
1487  std::ostream& operator << (std::ostream& os, const Expr<ExprT>& x) {
1488  typedef typename ExprT::value_type value_type;
1489  typedef typename ExprT::storage_type storage_type;
1491  os << a;
1492  return os;
1493  }
1494 
1495  } // namespace ETPCE
1496 
1497 } // namespace Sacado
1498 
1499 
1500 
1501 
1502 #endif // SACADO_ETPCE_ORTHOGPOLY_OPS_HPP
#define NONLINEAR_PCE_BINARYOP_MACRO(OPNAME, OP, OPER)
#define PCE_RELOP_MACRO(OP)
#define LINEAR_PCE_UNARYOP_MACRO(OPNAME, OP, OPER)
#define NONLINEAR_PCE_UNARYOP_MACRO(OPNAME, OP, OPER)
#define PCE_BOOL_MACRO(OP)
#define LINEAR_PCE_BINARYOP_MACRO(OPNAME, OP, OPER)
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 j expr1 expr1 expr1 expr1 j expr1 c *expr2 expr1 c expr1 c expr1 c expr1 expr1 expr1 expr1 j *expr1 expr2 expr1 expr1 j *expr1 c expr2 expr1 c expr1 expr2 expr1 expr2 expr1 Atan2Op
asinh(expr.val())
expr expr SinOp
expr expr SinhOp
expr expr SqrtOp
expr expr ACosOp
expr expr ATanOp
expr2 j expr1 expr1 expr2 expr2 j expr1 c c c c MinOp
expr expr ACoshOp
expr expr ASinOp
expr expr TanhOp
expr expr TanOp
expr expr CoshOp
expr expr ASinhOp
acosh(expr.val())
expr expr AbsOp
atan2(expr1.val(), expr2.val())
expr expr ATanhOp
expr expr expr expr ExpOp
atanh(expr.val())
expr expr CosOp
expr2 j expr1 expr1 expr2 expr2 j expr1 c c c c MaxOp
Stokhos::StandardStorage< int, double > storage_type
Sacado::Promote< value_type_1, value_type_2 >::type value_type
Sacado::Promote< value_type_1, value_type_2 >::type value_type
std::ostream & operator<<(std::ostream &os, const OrthogPoly< T, Storage > &a)
bool operator!(const Expr< ExprT > &expr)
Expr< MultiplicationOp< Expr< T1 >, Expr< T2 > > > operator*(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
bool toBool(const Expr< ExprT > &x)
Expr< DivisionOp< Expr< T1 >, Expr< T2 > > > operator/(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
KOKKOS_INLINE_FUNCTION PCE< Storage > asin(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > tanh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
KOKKOS_INLINE_FUNCTION PCE< Storage > fabs(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > tan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > min(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > max(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
KOKKOS_INLINE_FUNCTION PCE< Storage > sinh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cosh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cbrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > cos(const PCE< Storage > &a)
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
Definition: csr_vector.h:265