52#ifndef SACADO_FAD_OPS_HPP
53#define SACADO_FAD_OPS_HPP
60#define FAD_UNARYOP_MACRO(OPNAME,OP,USING,VALUE,DX,FASTACCESSDX) \
64 template <typename ExprT> \
67 template <typename ExprT> \
68 struct ExprSpec< OP<ExprT> > { \
69 typedef typename ExprSpec<ExprT>::type type; \
72 template <typename ExprT> \
73 class Expr< OP<ExprT>,ExprSpecDefault > { \
76 typedef typename ExprT::value_type value_type; \
77 typedef typename ExprT::scalar_type scalar_type; \
78 typedef typename ExprT::base_expr_type base_expr_type; \
80 SACADO_INLINE_FUNCTION \
81 explicit Expr(const ExprT& expr_) : expr(expr_) {} \
83 SACADO_INLINE_FUNCTION \
84 int size() const { return expr.size(); } \
86 SACADO_INLINE_FUNCTION \
87 bool hasFastAccess() const { return expr.hasFastAccess(); } \
89 SACADO_INLINE_FUNCTION \
90 bool isPassive() const { return expr.isPassive();} \
92 SACADO_INLINE_FUNCTION \
93 bool updateValue() const { return expr.updateValue(); } \
95 SACADO_INLINE_FUNCTION \
96 void cache() const {} \
98 SACADO_INLINE_FUNCTION \
99 value_type val() const { \
104 SACADO_INLINE_FUNCTION \
105 value_type dx(int i) const { \
110 SACADO_INLINE_FUNCTION \
111 value_type fastAccessDx(int i) const { \
113 return FASTACCESSDX; \
121 template <typename T> \
122 SACADO_INLINE_FUNCTION \
123 Expr< OP< Expr<T> > > \
124 OPNAME (const Expr<T>& expr) \
126 typedef OP< Expr<T> > expr_t; \
128 return Expr<expr_t>(expr); \
139 expr.fastAccessDx(
i))
145 -expr.fastAccessDx(
i))
150 exp(expr.val())*expr.dx(
i),
151 exp(expr.val())*expr.fastAccessDx(
i))
156 expr.dx(
i)/expr.val(),
157 expr.fastAccessDx(
i)/expr.val())
160 using std::log10;
using std::log;,
162 expr.dx(
i)/(
log(value_type(10))*expr.val()),
163 expr.fastAccessDx(
i) / (
log(value_type(10))*expr.val()))
168 expr.
dx(
i)/(value_type(2)* sqrt(expr.
val())),
172 using
std::cos; using
std::sin;,
174 -expr.
dx(
i)* sin(expr.
val()),
178 using
std::cos; using
std::sin;,
180 expr.
dx(
i)* cos(expr.
val()),
187 (value_type(1)+ tan(expr.
val())* tan(expr.
val())),
189 (value_type(1)+ tan(expr.
val())* tan(expr.
val())))
192 using
std::acos; using
std::sqrt;,
194 -expr.
dx(
i)/ sqrt(value_type(1)-expr.
val()*expr.
val()),
196 sqrt(value_type(1)-expr.
val()*expr.
val()))
199 using
std::asin; using
std::sqrt;,
201 expr.
dx(
i)/ sqrt(value_type(1)-expr.
val()*expr.
val()),
203 sqrt(value_type(1)-expr.
val()*expr.
val()))
208 expr.
dx(
i)/(value_type(1)+expr.
val()*expr.
val()),
212 using
std::cosh; using
std::sinh;,
214 expr.
dx(
i)* sinh(expr.
val()),
218 using
std::cosh; using
std::sinh;,
220 expr.
dx(
i)* cosh(expr.
val()),
226 expr.
dx(
i)*(value_type(1)-tanh(expr.
val())*tanh(expr.
val())),
230 using
std::acosh; using
std::sqrt;,
232 expr.
dx(
i)/ sqrt((expr.
val()-value_type(1)) *
233 (expr.
val()+value_type(1))),
235 (expr.
val()+value_type(1))))
238 using
std::asinh; using
std::sqrt;,
240 expr.
dx(
i)/ sqrt(value_type(1)+expr.
val()*expr.
val()),
247 expr.
dx(
i)/(value_type(1)-expr.
val()*expr.
val()),
252 using
std::abs; using
Sacado::if_then_else;,
254 if_then_else( expr.
val() >= 0, expr.
dx(
i), value_type(-expr.
dx(
i)) ),
258 using
std::fabs; using
Sacado::if_then_else;,
260 if_then_else( expr.
val() >= 0, expr.
dx(
i), value_type(-expr.
dx(
i)) ),
262#ifdef HAVE_SACADO_CXX11
267 expr.dx(
i)/(value_type(3)*
cbrt(expr.val()*expr.val())),
268 expr.fastAccessDx(
i)/(value_type(3)*
cbrt(expr.val()*expr.val())))
271#undef FAD_UNARYOP_MACRO
280 template <
typename ExprT,
bool is_simd>
283 template <
typename ExprT>
291 template <
typename ExprT>
295 typedef typename ExprT::value_type
value_type;
296 typedef typename ExprT::scalar_type scalar_type;
297 typedef typename ExprT::base_expr_type base_expr_type;
300 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
303 int size()
const {
return expr.size(); }
306 bool hasFastAccess()
const {
return expr.hasFastAccess(); }
309 bool isPassive()
const {
return expr.isPassive();}
312 bool updateValue()
const {
return expr.updateValue(); }
315 void cache()
const {}
320 return sqrt(expr.val());
347 template <
typename ExprT>
351 typedef typename ExprT::value_type
value_type;
352 typedef typename ExprT::scalar_type scalar_type;
353 typedef typename ExprT::base_expr_type base_expr_type;
356 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
359 int size()
const {
return expr.size(); }
362 bool hasFastAccess()
const {
return expr.hasFastAccess(); }
365 bool isPassive()
const {
return expr.isPassive();}
368 bool updateValue()
const {
return expr.updateValue(); }
371 void cache()
const {}
376 return sqrt(expr.val());
398 template <
typename T>
400 Expr< SafeSqrtOp< Expr<T> > >
403 typedef SafeSqrtOp< Expr<T> > expr_t;
405 return Expr<expr_t>(expr);
411#define FAD_BINARYOP_MACRO(OPNAME,OP,USING,VALUE,DX,FASTACCESSDX,VAL_CONST_DX_1,VAL_CONST_DX_2,CONST_DX_1,CONST_DX_2,CONST_FASTACCESSDX_1,CONST_FASTACCESSDX_2) \
415 template <typename ExprT1, typename ExprT2> \
418 template <typename ExprT1, typename ExprT2> \
419 struct ExprSpec< OP< ExprT1, ExprT2 > > { \
420 typedef typename ExprSpec<ExprT1>::type type; \
423 template <typename ExprT1, typename ExprT2> \
424 class Expr< OP< ExprT1, ExprT2 >,ExprSpecDefault > { \
428 typedef typename ExprT1::value_type value_type_1; \
429 typedef typename ExprT2::value_type value_type_2; \
430 typedef typename Sacado::Promote<value_type_1, \
431 value_type_2>::type value_type; \
433 typedef typename ExprT1::scalar_type scalar_type_1; \
434 typedef typename ExprT2::scalar_type scalar_type_2; \
435 typedef typename Sacado::Promote<scalar_type_1, \
436 scalar_type_2>::type scalar_type; \
438 typedef typename ExprT1::base_expr_type base_expr_type_1; \
439 typedef typename ExprT2::base_expr_type base_expr_type_2; \
440 typedef typename Sacado::Promote<base_expr_type_1, \
441 base_expr_type_2>::type base_expr_type; \
443 SACADO_INLINE_FUNCTION \
444 Expr(const ExprT1& expr1_, const ExprT2& expr2_) : \
445 expr1(expr1_), expr2(expr2_) {} \
447 SACADO_INLINE_FUNCTION \
449 int sz1 = expr1.size(), sz2 = expr2.size(); \
450 return sz1 > sz2 ? sz1 : sz2; \
453 SACADO_INLINE_FUNCTION \
454 bool hasFastAccess() const { \
455 return expr1.hasFastAccess() && expr2.hasFastAccess(); \
458 SACADO_INLINE_FUNCTION \
459 bool isPassive() const { \
460 return expr1.isPassive() && expr2.isPassive(); \
463 SACADO_INLINE_FUNCTION \
464 bool updateValue() const { \
465 return expr1.updateValue() && expr2.updateValue(); \
468 SACADO_INLINE_FUNCTION \
469 void cache() const {} \
471 SACADO_INLINE_FUNCTION \
472 const value_type val() const { \
477 SACADO_INLINE_FUNCTION \
478 const value_type dx(int i) const { \
483 SACADO_INLINE_FUNCTION \
484 const value_type fastAccessDx(int i) const { \
486 return FASTACCESSDX; \
491 const ExprT1& expr1; \
492 const ExprT2& expr2; \
496 template <typename ExprT1, typename T2> \
497 struct ExprSpec< OP< ExprT1, ConstExpr<T2> > > { \
498 typedef typename ExprSpec<ExprT1>::type type; \
501 template <typename ExprT1, typename T2> \
502 class Expr< OP< ExprT1, ConstExpr<T2> >,ExprSpecDefault > { \
506 typedef ConstExpr<T2> ConstT; \
507 typedef ConstExpr<T2> ExprT2; \
508 typedef typename ExprT1::value_type value_type_1; \
509 typedef typename ExprT2::value_type value_type_2; \
510 typedef typename Sacado::Promote<value_type_1, \
511 value_type_2>::type value_type; \
513 typedef typename ExprT1::scalar_type scalar_type_1; \
514 typedef typename ExprT2::scalar_type scalar_type_2; \
515 typedef typename Sacado::Promote<scalar_type_1, \
516 scalar_type_2>::type scalar_type; \
518 typedef typename ExprT1::base_expr_type base_expr_type_1; \
519 typedef typename ExprT2::base_expr_type base_expr_type_2; \
520 typedef typename Sacado::Promote<base_expr_type_1, \
521 base_expr_type_2>::type base_expr_type; \
523 SACADO_INLINE_FUNCTION \
524 Expr(const ExprT1& expr1_, const ConstT& c_) : \
525 expr1(expr1_), c(c_) {} \
527 SACADO_INLINE_FUNCTION \
529 return expr1.size(); \
532 SACADO_INLINE_FUNCTION \
533 bool hasFastAccess() const { \
534 return expr1.hasFastAccess(); \
537 SACADO_INLINE_FUNCTION \
538 bool isPassive() const { \
539 return expr1.isPassive(); \
542 SACADO_INLINE_FUNCTION \
543 bool updateValue() const { return expr1.updateValue(); } \
545 SACADO_INLINE_FUNCTION \
546 void cache() const {} \
548 SACADO_INLINE_FUNCTION \
549 const value_type val() const { \
551 return VAL_CONST_DX_2; \
554 SACADO_INLINE_FUNCTION \
555 const value_type dx(int i) const { \
560 SACADO_INLINE_FUNCTION \
561 const value_type fastAccessDx(int i) const { \
563 return CONST_FASTACCESSDX_2; \
568 const ExprT1& expr1; \
572 template <typename T1, typename ExprT2> \
573 struct ExprSpec< OP< ConstExpr<T1>, ExprT2 > > { \
574 typedef typename ExprSpec<ExprT2>::type type; \
577 template <typename T1, typename ExprT2> \
578 class Expr< OP< ConstExpr<T1>, ExprT2 >,ExprSpecDefault > { \
582 typedef ConstExpr<T1> ConstT; \
583 typedef ConstExpr<T1> ExprT1; \
584 typedef typename ExprT1::value_type value_type_1; \
585 typedef typename ExprT2::value_type value_type_2; \
586 typedef typename Sacado::Promote<value_type_1, \
587 value_type_2>::type value_type; \
589 typedef typename ExprT1::scalar_type scalar_type_1; \
590 typedef typename ExprT2::scalar_type scalar_type_2; \
591 typedef typename Sacado::Promote<scalar_type_1, \
592 scalar_type_2>::type scalar_type; \
594 typedef typename ExprT1::base_expr_type base_expr_type_1; \
595 typedef typename ExprT2::base_expr_type base_expr_type_2; \
596 typedef typename Sacado::Promote<base_expr_type_1, \
597 base_expr_type_2>::type base_expr_type; \
600 SACADO_INLINE_FUNCTION \
601 Expr(const ConstT& c_, const ExprT2& expr2_) : \
602 c(c_), expr2(expr2_) {} \
604 SACADO_INLINE_FUNCTION \
606 return expr2.size(); \
609 SACADO_INLINE_FUNCTION \
610 bool hasFastAccess() const { \
611 return expr2.hasFastAccess(); \
614 SACADO_INLINE_FUNCTION \
615 bool isPassive() const { \
616 return expr2.isPassive(); \
619 SACADO_INLINE_FUNCTION \
620 bool updateValue() const { return expr2.updateValue(); } \
622 SACADO_INLINE_FUNCTION \
623 void cache() const {} \
625 SACADO_INLINE_FUNCTION \
626 const value_type val() const { \
628 return VAL_CONST_DX_1; \
631 SACADO_INLINE_FUNCTION \
632 const value_type dx(int i) const { \
637 SACADO_INLINE_FUNCTION \
638 const value_type fastAccessDx(int i) const { \
640 return CONST_FASTACCESSDX_1; \
646 const ExprT2& expr2; \
649 template <typename T1, typename T2> \
650 SACADO_INLINE_FUNCTION \
651 typename mpl::enable_if_c< \
652 ExprLevel< Expr<T1> >::value == ExprLevel< Expr<T2> >::value, \
653 Expr< OP< Expr<T1>, Expr<T2> > > \
656 OPNAME (const Expr<T1>& expr1, const Expr<T2>& expr2) \
658 typedef OP< Expr<T1>, Expr<T2> > expr_t; \
660 return Expr<expr_t>(expr1, expr2); \
663 template <typename T> \
664 SACADO_INLINE_FUNCTION \
665 Expr< OP< Expr<T>, Expr<T> > > \
666 OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
668 typedef OP< Expr<T>, Expr<T> > expr_t; \
670 return Expr<expr_t>(expr1, expr2); \
673 template <typename T> \
674 SACADO_INLINE_FUNCTION \
675 Expr< OP< ConstExpr<typename Expr<T>::value_type>, \
677 OPNAME (const typename Expr<T>::value_type& c, \
678 const Expr<T>& expr) \
680 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
681 typedef OP< ConstT, Expr<T> > expr_t; \
683 return Expr<expr_t>(ConstT(c), expr); \
686 template <typename T> \
687 SACADO_INLINE_FUNCTION \
689 ConstExpr<typename Expr<T>::value_type> > > \
690 OPNAME (const Expr<T>& expr, \
691 const typename Expr<T>::value_type& c) \
693 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
694 typedef OP< Expr<T>, ConstT > expr_t; \
696 return Expr<expr_t>(expr, ConstT(c)); \
699 template <typename T> \
700 SACADO_INLINE_FUNCTION \
701 SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
702 OPNAME (const typename Expr<T>::scalar_type& c, \
703 const Expr<T>& expr) \
705 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
706 typedef OP< ConstT, Expr<T> > expr_t; \
708 return Expr<expr_t>(ConstT(c), expr); \
711 template <typename T> \
712 SACADO_INLINE_FUNCTION \
713 SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
714 OPNAME (const Expr<T>& expr, \
715 const typename Expr<T>::scalar_type& c) \
717 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
718 typedef OP< Expr<T>, ConstT > expr_t; \
720 return Expr<expr_t>(expr, ConstT(c)); \
730 expr1.val() + expr2.val(),
731 expr1.dx(
i) + expr2.dx(
i),
732 expr1.fastAccessDx(
i) + expr2.fastAccessDx(
i),
733 c.val() + expr2.val(),
734 expr1.val() +
c.val(),
737 expr2.fastAccessDx(
i),
738 expr1.fastAccessDx(
i))
742 expr1.val() - expr2.val(),
743 expr1.dx(
i) - expr2.dx(
i),
744 expr1.fastAccessDx(
i) - expr2.fastAccessDx(
i),
745 c.val() - expr2.val(),
746 expr1.val() -
c.val(),
749 -expr2.fastAccessDx(
i),
750 expr1.fastAccessDx(
i))
767 expr1.val() / expr2.val(),
768 (expr1.dx(
i)*expr2.val() - expr2.dx(
i)*expr1.val()) /
769 (expr2.val()*expr2.val()),
770 (expr1.fastAccessDx(
i)*expr2.val() -
771 expr2.fastAccessDx(
i)*expr1.val()) /
772 (expr2.val()*expr2.val()),
773 c.val() / expr2.val(),
774 expr1.val() /
c.val(),
775 -expr2.dx(
i)*
c.val() / (expr2.val()*expr2.val()),
777 -expr2.fastAccessDx(
i)*
c.val() / (expr2.val()*expr2.val()),
778 expr1.fastAccessDx(
i)/
c.val())
807 using
Sacado::if_then_else;,
813 if_then_else(
c.
val() >= expr2.
val(), value_type(0.0), expr2.
dx(
i) ),
814 if_then_else( expr1.
val() >=
c.
val(), expr1.
dx(
i), value_type(0.0) ),
819 using
Sacado::if_then_else;,
825 if_then_else(
c.
val() <= expr2.
val(), value_type(0), expr2.
dx(
i) ),
826 if_then_else( expr1.
val() <=
c.
val(), expr1.
dx(
i), value_type(0) ),
831#undef FAD_BINARYOP_MACRO
836 template <
typename ExprT1,
typename ExprT2>
839 template <
typename ExprT1,
typename ExprT2>
844 template <
typename ExprT1,
typename ExprT2>
849 typedef typename ExprT1::value_type value_type_1;
850 typedef typename ExprT2::value_type value_type_2;
854 typedef typename ExprT1::scalar_type scalar_type_1;
855 typedef typename ExprT2::scalar_type scalar_type_2;
857 scalar_type_2>::type scalar_type;
859 typedef typename ExprT1::base_expr_type base_expr_type_1;
860 typedef typename ExprT2::base_expr_type base_expr_type_2;
862 base_expr_type_2>::type base_expr_type;
865 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
866 expr1(expr1_), expr2(expr2_) {}
870 int sz1 = expr1.size(), sz2 = expr2.size();
871 return sz1 > sz2 ? sz1 : sz2;
875 bool hasFastAccess()
const {
876 return expr1.hasFastAccess() && expr2.hasFastAccess();
880 bool isPassive()
const {
881 return expr1.isPassive() && expr2.isPassive();
885 bool updateValue()
const {
886 return expr1.updateValue() && expr2.updateValue();
890 void cache()
const {}
894 return expr1.val()*expr2.val();
899 if (expr1.size() > 0 && expr2.size() > 0)
900 return expr1.val()*expr2.dx(
i) + expr1.dx(
i)*expr2.val();
901 else if (expr1.size() > 0)
902 return expr1.dx(
i)*expr2.val();
904 return expr1.val()*expr2.dx(
i);
909 return expr1.val()*expr2.fastAccessDx(
i) +
910 expr1.fastAccessDx(
i)*expr2.val();
920 template <
typename ExprT1,
typename T2>
925 template <
typename ExprT1,
typename T2>
930 typedef ConstExpr<T2> ConstT;
931 typedef ConstExpr<T2> ExprT2;
932 typedef typename ExprT1::value_type value_type_1;
933 typedef typename ExprT2::value_type value_type_2;
937 typedef typename ExprT1::scalar_type scalar_type_1;
938 typedef typename ExprT2::scalar_type scalar_type_2;
940 scalar_type_2>::type scalar_type;
942 typedef typename ExprT1::base_expr_type base_expr_type_1;
943 typedef typename ExprT2::base_expr_type base_expr_type_2;
945 base_expr_type_2>::type base_expr_type;
948 Expr(
const ExprT1& expr1_,
const ConstT&
c_) :
949 expr1(expr1_),
c(
c_) {}
957 bool hasFastAccess()
const {
958 return expr1.hasFastAccess();
962 bool isPassive()
const {
963 return expr1.isPassive();
967 bool updateValue()
const {
return expr1.updateValue(); }
970 void cache()
const {}
974 return expr1.val()*
c.val();
979 return expr1.dx(
i)*
c.val();
984 return expr1.fastAccessDx(
i)*
c.val();
993 template <
typename T1,
typename ExprT2>
998 template <
typename T1,
typename ExprT2>
1003 typedef ConstExpr<T1> ConstT;
1004 typedef ConstExpr<T1> ExprT1;
1005 typedef typename ExprT1::value_type value_type_1;
1006 typedef typename ExprT2::value_type value_type_2;
1010 typedef typename ExprT1::scalar_type scalar_type_1;
1011 typedef typename ExprT2::scalar_type scalar_type_2;
1013 scalar_type_2>::type scalar_type;
1015 typedef typename ExprT1::base_expr_type base_expr_type_1;
1016 typedef typename ExprT2::base_expr_type base_expr_type_2;
1018 base_expr_type_2>::type base_expr_type;
1021 Expr(
const ConstT&
c_,
const ExprT2& expr2_) :
1022 c(
c_), expr2(expr2_) {}
1026 return expr2.size();
1030 bool hasFastAccess()
const {
1031 return expr2.hasFastAccess();
1035 bool isPassive()
const {
1036 return expr2.isPassive();
1040 bool updateValue()
const {
return expr2.updateValue(); }
1043 void cache()
const {}
1047 return c.val()*expr2.val();
1052 return c.val()*expr2.dx(
i);
1057 return c.val()*expr2.fastAccessDx(
i);
1063 const ExprT2& expr2;
1066 template <
typename T1,
typename T2>
1068 typename mpl::enable_if_c<
1070 Expr< MultiplicationOp< Expr<T1>, Expr<T2> > >
1073 operator* (
const Expr<T1>& expr1,
const Expr<T2>& expr2)
1075 typedef MultiplicationOp< Expr<T1>, Expr<T2> > expr_t;
1077 return Expr<expr_t>(expr1, expr2);
1080 template <
typename T>
1082 Expr< MultiplicationOp< Expr<T>, Expr<T> > >
1083 operator* (
const Expr<T>& expr1,
const Expr<T>& expr2)
1085 typedef MultiplicationOp< Expr<T>, Expr<T> > expr_t;
1087 return Expr<expr_t>(expr1, expr2);
1090 template <
typename T>
1092 Expr< MultiplicationOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
1094 const Expr<T>& expr)
1096 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1097 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
1099 return Expr<expr_t>(ConstT(
c), expr);
1102 template <
typename T>
1104 Expr< MultiplicationOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
1108 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1109 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
1111 return Expr<expr_t>(expr, ConstT(
c));
1114 template <
typename T>
1117 operator* (
const typename Expr<T>::scalar_type&
c,
1118 const Expr<T>& expr)
1120 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1121 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
1123 return Expr<expr_t>(ConstT(
c), expr);
1126 template <
typename T>
1130 const typename Expr<T>::scalar_type&
c)
1132 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1133 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
1135 return Expr<expr_t>(expr, ConstT(
c));
1147 template <
typename ExprT1,
typename ExprT2,
typename Impl>
1150 template <
typename ExprT1,
typename ExprT2>
1155 template <
typename ExprT1,
typename T2>
1160 template <
typename T1,
typename ExprT2>
1168 template <
typename ExprT1,
typename ExprT2>
1189 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1190 expr1(expr1_), expr2(expr2_) {}
1194 int sz1 = expr1.size(), sz2 = expr2.size();
1195 return sz1 > sz2 ? sz1 : sz2;
1200 return expr1.hasFastAccess() && expr2.hasFastAccess();
1205 return expr1.isPassive() && expr2.isPassive();
1210 return expr1.updateValue() && expr2.updateValue();
1219 return pow(expr1.val(), expr2.val());
1225 const int sz1 = expr1.size(), sz2 = expr2.size();
1226 if (sz1 > 0 && sz2 > 0)
1249 template <
typename ExprT1,
typename T2>
1274 expr1(expr1_),
c(
c_) {}
1278 return expr1.size();
1283 return expr1.hasFastAccess();
1288 return expr1.isPassive();
1300 return pow(expr1.val(),
c.val());
1325 template <
typename T1,
typename ExprT2>
1351 c(
c_), expr2(expr2_) {}
1355 return expr2.size();
1360 return expr2.hasFastAccess();
1365 return expr2.isPassive();
1377 return pow(
c.val(), expr2.val());
1402 template <
typename ExprT1,
typename ExprT2>
1424 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1425 expr1(expr1_), expr2(expr2_) {}
1429 int sz1 = expr1.size(), sz2 = expr2.size();
1430 return sz1 > sz2 ? sz1 : sz2;
1435 return expr1.hasFastAccess() && expr2.hasFastAccess();
1440 return expr1.isPassive() && expr2.isPassive();
1445 return expr1.updateValue() && expr2.updateValue();
1454 return pow(expr1.val(), expr2.val());
1459 using std::pow;
using std::log;
1460 const int sz1 = expr1.size(), sz2 = expr2.size();
1461 if (sz1 > 0 && sz2 > 0)
1473 using std::pow;
using std::log;
1484 template <
typename ExprT1,
typename T2>
1509 expr1(expr1_),
c(
c_) {}
1513 return expr1.size();
1518 return expr1.hasFastAccess();
1523 return expr1.isPassive();
1535 return pow(expr1.val(),
c.val());
1560 template <
typename T1,
typename ExprT2>
1586 c(
c_), expr2(expr2_) {}
1590 return expr2.size();
1595 return expr2.hasFastAccess();
1600 return expr2.isPassive();
1612 return pow(
c.val(), expr2.val());
1617 using std::pow;
using std::log;
1623 using std::pow;
using std::log;
1638 template <
typename ExprT1,
typename ExprT2>
1660 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1661 expr1(expr1_), expr2(expr2_) {}
1665 int sz1 = expr1.size(), sz2 = expr2.size();
1666 return sz1 > sz2 ? sz1 : sz2;
1671 return expr1.hasFastAccess() && expr2.hasFastAccess();
1676 return expr1.isPassive() && expr2.isPassive();
1681 return expr1.updateValue() && expr2.updateValue();
1690 return pow(expr1.val(), expr2.val());
1695 using std::pow;
using std::log;
1696 const int sz1 = expr1.size(), sz2 = expr2.size();
1697 if (sz1 > 0 && sz2 > 0)
1698 return (expr2.dx(
i)*
log(expr1.val())+expr2.val()*expr1.dx(
i)/expr1.val())*
pow(expr1.val(),expr2.val());
1702 return expr2.dx(
i)*
log(expr1.val())*
pow(expr1.val(),expr2.val());
1707 using std::pow;
using std::log;
1708 return (expr2.fastAccessDx(
i)*
log(expr1.val())+expr2.val()*expr1.fastAccessDx(
i)/expr1.val())*
pow(expr1.val(),expr2.val());
1718 template <
typename ExprT1,
typename T2>
1743 expr1(expr1_),
c(
c_) {}
1747 return expr1.size();
1752 return expr1.hasFastAccess();
1757 return expr1.isPassive();
1769 return pow(expr1.val(),
c.val());
1790 template <
typename T1,
typename ExprT2>
1816 c(
c_), expr2(expr2_) {}
1820 return expr2.size();
1825 return expr2.hasFastAccess();
1830 return expr2.isPassive();
1842 return pow(
c.val(), expr2.val());
1847 using std::pow;
using std::log;
1848 return expr2.dx(
i)*
log(
c.val())*
pow(
c.val(),expr2.val());
1853 using std::pow;
using std::log;
1854 return expr2.fastAccessDx(
i)*
log(
c.val())*
pow(
c.val(),expr2.val());
1868 template <
typename ExprT1,
typename ExprT2>
1890 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1891 expr1(expr1_), expr2(expr2_) {}
1895 int sz1 = expr1.size(), sz2 = expr2.size();
1896 return sz1 > sz2 ? sz1 : sz2;
1901 return expr1.hasFastAccess() && expr2.hasFastAccess();
1906 return expr1.isPassive() && expr2.isPassive();
1911 return expr1.updateValue() && expr2.updateValue();
1920 return pow(expr1.val(), expr2.val());
1926 const int sz1 = expr1.size(), sz2 = expr2.size();
1927 if (sz1 > 0 && sz2 > 0)
1928 return (expr2.dx(
i)*
log(expr1.val())+expr2.val()*expr1.dx(
i)/expr1.val())*
pow(expr1.val(),expr2.val());
1932 return expr2.dx(
i)*
log(expr1.val())*
pow(expr1.val(),expr2.val());
1937 using std::pow;
using std::log;
1938 return (expr2.fastAccessDx(
i)*
log(expr1.val())+expr2.val()*expr1.fastAccessDx(
i)/expr1.val())*
pow(expr1.val(),expr2.val());
1948 template <
typename ExprT1,
typename T2>
1973 expr1(expr1_),
c(
c_) {}
1977 return expr1.size();
1982 return expr1.hasFastAccess();
1987 return expr1.isPassive();
1999 return pow(expr1.val(),
c.val());
2020 template <
typename T1,
typename ExprT2>
2046 c(
c_), expr2(expr2_) {}
2050 return expr2.size();
2055 return expr2.hasFastAccess();
2060 return expr2.isPassive();
2072 return pow(
c.val(), expr2.val());
2077 using std::pow;
using std::log;
2078 return expr2.dx(
i)*
log(
c.val())*
pow(
c.val(),expr2.val());
2083 using std::pow;
using std::log;
2084 return expr2.fastAccessDx(
i)*
log(
c.val())*
pow(
c.val(),expr2.val());
2093 template <
typename T1,
typename T2>
2107 template <
typename T>
2109 Expr< PowerOp< Expr<T>, Expr<T> > >
2117 template <
typename T>
2119 Expr< PowerOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
2129 template <
typename T>
2131 Expr< PowerOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
2141 template <
typename T>
2145 const
Expr<
T>& expr)
2153 template <
typename T>
2157 const typename
Expr<
T>::scalar_type&
c)
2171#ifdef HAVE_SACADO_CXX11
2176 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2177 class IfThenElseOp {};
2179 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2180 struct ExprSpec< IfThenElseOp< CondT, ExprT1, ExprT2 > > {
2184 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2185 class Expr< IfThenElseOp< CondT, ExprT1, ExprT2 >,ExprSpecDefault > {
2189 typedef typename ExprT1::value_type value_type_1;
2190 typedef typename ExprT2::value_type value_type_2;
2194 typedef typename ExprT1::scalar_type scalar_type_1;
2195 typedef typename ExprT2::scalar_type scalar_type_2;
2197 scalar_type_2>::type scalar_type;
2199 typedef typename ExprT1::base_expr_type base_expr_type_1;
2200 typedef typename ExprT2::base_expr_type base_expr_type_2;
2202 base_expr_type_2>::type base_expr_type;
2205 Expr(
const CondT& cond_,
const ExprT1& expr1_,
const ExprT2& expr2_) :
2206 cond(cond_), expr1(expr1_), expr2(expr2_) {}
2210 int sz1 = expr1.size(), sz2 = expr2.size();
2211 return sz1 > sz2 ? sz1 : sz2;
2215 bool hasFastAccess()
const {
2216 return expr1.hasFastAccess() && expr2.hasFastAccess();
2220 bool isPassive()
const {
2221 return expr1.isPassive() && expr2.isPassive();
2225 bool updateValue()
const {
2226 return expr1.updateValue() && expr2.updateValue();
2230 void cache()
const {}
2247 return if_then_else( cond, expr1.fastAccessDx(
i), expr2.fastAccessDx(
i) );
2253 const ExprT1& expr1;
2254 const ExprT2& expr2;
2258 template <
typename CondT,
typename ExprT1,
typename T2>
2259 struct ExprSpec< IfThenElseOp< CondT, ExprT1, ConstExpr<
T2> > > {
2263 template <
typename CondT,
typename ExprT1,
typename T2>
2264 class Expr< IfThenElseOp< CondT, ExprT1, ConstExpr<
T2> >,ExprSpecDefault > {
2268 typedef ConstExpr<T2> ConstT;
2269 typedef ConstExpr<T2> ExprT2;
2270 typedef typename ExprT1::value_type value_type_1;
2271 typedef typename ExprT2::value_type value_type_2;
2275 typedef typename ExprT1::scalar_type scalar_type_1;
2276 typedef typename ExprT2::scalar_type scalar_type_2;
2278 scalar_type_2>::type scalar_type;
2280 typedef typename ExprT1::base_expr_type base_expr_type_1;
2281 typedef typename ExprT2::base_expr_type base_expr_type_2;
2283 base_expr_type_2>::type base_expr_type;
2286 Expr(
const CondT& cond_,
const ExprT1& expr1_,
const ConstT&
c_) :
2287 cond(cond_), expr1(expr1_),
c(
c_) {}
2291 return expr1.size();
2295 bool hasFastAccess()
const {
2296 return expr1.hasFastAccess();
2300 bool isPassive()
const {
2301 return expr1.isPassive();
2305 bool updateValue()
const {
return expr1.updateValue(); }
2308 void cache()
const {}
2331 const ExprT1& expr1;
2335 template <
typename CondT,
typename T1,
typename ExprT2>
2336 struct ExprSpec< IfThenElseOp< CondT, ConstExpr<
T1>, ExprT2 > > {
2340 template <
typename CondT,
typename T1,
typename ExprT2>
2341 class Expr< IfThenElseOp< CondT, ConstExpr<
T1>, ExprT2 >,ExprSpecDefault > {
2345 typedef ConstExpr<T1> ConstT;
2346 typedef ConstExpr<T1> ExprT1;
2347 typedef typename ExprT1::value_type value_type_1;
2348 typedef typename ExprT2::value_type value_type_2;
2352 typedef typename ExprT1::scalar_type scalar_type_1;
2353 typedef typename ExprT2::scalar_type scalar_type_2;
2355 scalar_type_2>::type scalar_type;
2357 typedef typename ExprT1::base_expr_type base_expr_type_1;
2358 typedef typename ExprT2::base_expr_type base_expr_type_2;
2360 base_expr_type_2>::type base_expr_type;
2363 Expr(
const CondT& cond_,
const ConstT&
c_,
const ExprT2& expr2_) :
2364 cond(cond_),
c(
c_), expr2(expr2_) {}
2368 return expr2.size();
2372 bool hasFastAccess()
const {
2373 return expr2.hasFastAccess();
2377 bool isPassive()
const {
2378 return expr2.isPassive();
2382 bool updateValue()
const {
return expr2.updateValue(); }
2385 void cache()
const {}
2409 const ExprT2& expr2;
2412 template <
typename CondT,
typename T1,
typename T2>
2416 Expr< IfThenElseOp< CondT, T1, T2 > >
2420 typedef IfThenElseOp< CondT, T1, T2 > expr_t;
2422 return Expr<expr_t>(cond, expr1, expr2);
2425 template <
typename CondT,
typename T>
2427 Expr< IfThenElseOp< CondT, Expr<T>, Expr<T> > >
2428 if_then_else (
const CondT& cond,
const Expr<T>& expr1,
const Expr<T>& expr2)
2430 typedef IfThenElseOp< CondT, Expr<T>, Expr<T> > expr_t;
2432 return Expr<expr_t>(cond, expr1, expr2);
2435 template <
typename CondT,
typename T>
2437 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::value_type>,
2440 const Expr<T>& expr)
2442 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
2443 typedef IfThenElseOp< CondT, ConstT, Expr<T> > expr_t;
2445 return Expr<expr_t>(cond, ConstT(
c), expr);
2448 template <
typename CondT,
typename T>
2450 Expr< IfThenElseOp< CondT, Expr<T>,
2451 ConstExpr<typename Expr<T>::value_type> > >
2455 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
2456 typedef IfThenElseOp< CondT, Expr<T>, ConstT > expr_t;
2458 return Expr<expr_t>(cond, expr, ConstT(
c));
2461 template <
typename CondT,
typename T>
2463 typename mpl::disable_if<
2464 mpl::is_same< typename Expr<T>::value_type,
2465 typename Expr<T>::scalar_type>,
2466 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::scalar_type>,
2469 if_then_else (
const CondT& cond,
const typename Expr<T>::scalar_type&
c,
2470 const Expr<T>& expr)
2472 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
2473 typedef IfThenElseOp< CondT, ConstT, Expr<T> > expr_t;
2475 return Expr<expr_t>(cond, ConstT(
c), expr);
2478 template <
typename CondT,
typename T>
2480 typename mpl::disable_if<
2481 mpl::is_same< typename Expr<T>::value_type,
2482 typename Expr<T>::scalar_type>,
2483 Expr< IfThenElseOp< CondT, Expr<T>,
2484 ConstExpr<typename Expr<T>::scalar_type> > >
2487 const typename Expr<T>::scalar_type&
c)
2489 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
2490 typedef IfThenElseOp< CondT, Expr<T>, ConstT > expr_t;
2492 return Expr<expr_t>(cond, expr, ConstT(
c));
2501#ifdef HAVE_SACADO_CXX11
2505 template <
typename T1,
typename T2 = T1>
2506 struct ConditionalReturnType {
2507 typedef decltype( std::declval<T1>() == std::declval<T2>() ) type;
2512#define FAD_RELOP_MACRO(OP) \
2515 template <typename ExprT1, typename ExprT2> \
2516 SACADO_INLINE_FUNCTION \
2517 typename ConditionalReturnType<typename Expr<ExprT1>::value_type, \
2518 typename Expr<ExprT2>::value_type>::type \
2519 operator OP (const Expr<ExprT1>& expr1, \
2520 const Expr<ExprT2>& expr2) \
2522 return expr1.val() OP expr2.val(); \
2525 template <typename ExprT2> \
2526 SACADO_INLINE_FUNCTION \
2527 typename ConditionalReturnType<typename Expr<ExprT2>::value_type>::type \
2528 operator OP (const typename Expr<ExprT2>::value_type& a, \
2529 const Expr<ExprT2>& expr2) \
2531 return a OP expr2.val(); \
2534 template <typename ExprT1> \
2535 SACADO_INLINE_FUNCTION \
2536 typename ConditionalReturnType<typename Expr<ExprT1>::value_type>::type \
2537 operator OP (const Expr<ExprT1>& expr1, \
2538 const typename Expr<ExprT1>::value_type& b) \
2540 return expr1.val() OP b; \
2547#define FAD_RELOP_MACRO(OP) \
2550 template <typename ExprT1, typename ExprT2> \
2551 SACADO_INLINE_FUNCTION \
2553 operator OP (const Expr<ExprT1>& expr1, \
2554 const Expr<ExprT2>& expr2) \
2556 return expr1.val() OP expr2.val(); \
2559 template <typename ExprT2> \
2560 SACADO_INLINE_FUNCTION \
2562 operator OP (const typename Expr<ExprT2>::value_type& a, \
2563 const Expr<ExprT2>& expr2) \
2565 return a OP expr2.val(); \
2568 template <typename ExprT1> \
2569 SACADO_INLINE_FUNCTION \
2571 operator OP (const Expr<ExprT1>& expr1, \
2572 const typename Expr<ExprT1>::value_type& b) \
2574 return expr1.val() OP b; \
2592#undef FAD_RELOP_MACRO
2598 template <
typename ExprT>
2602 return ! expr.val();
2614 template <
typename ExprT>
2617 bool is_zero = (
x.val() == 0.0);
2618 for (
int i=0;
i<
x.size();
i++)
2619 is_zero = is_zero && (
x.dx(
i) == 0.0);
2627#define FAD_BOOL_MACRO(OP) \
2630 template <typename ExprT1, typename ExprT2> \
2631 SACADO_INLINE_FUNCTION \
2633 operator OP (const Expr<ExprT1>& expr1, \
2634 const Expr<ExprT2>& expr2) \
2636 return toBool(expr1) OP toBool(expr2); \
2639 template <typename ExprT2> \
2640 SACADO_INLINE_FUNCTION \
2642 operator OP (const typename Expr<ExprT2>::value_type& a, \
2643 const Expr<ExprT2>& expr2) \
2645 return a OP toBool(expr2); \
2648 template <typename ExprT1> \
2649 SACADO_INLINE_FUNCTION \
2651 operator OP (const Expr<ExprT1>& expr1, \
2652 const typename Expr<ExprT1>::value_type& b) \
2654 return toBool(expr1) OP b; \
2662#undef FAD_BOOL_MACRO
2670 template <
typename ExprT>
2672 os <<
x.val() <<
" [";
2674 for (
int i=0;
i<
x.size();
i++) {
2675 os <<
" " <<
x.dx(
i);
#define SACADO_INLINE_FUNCTION
if_then_else(expr.val() >=0, expr.dx(i), value_type(-expr.dx(i)))
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 MultiplicationOp
#define FAD_BINARYOP_MACRO(OPNAME, OP, USING, VALUE, DX, FASTACCESSDX, VAL_CONST_DX_1, VAL_CONST_DX_2, CONST_DX_1, CONST_DX_2, CONST_FASTACCESSDX_1, CONST_FASTACCESSDX_2)
expr1 expr1 expr1 c expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr1 expr2 expr1 expr2 expr1 Atan2Op
#define FAD_UNARYOP_MACRO(OPNAME, OP, USING, VALUE, DX, FASTACCESSDX)
expr1 expr1 expr1 c expr1 expr2 expr1 expr2 expr1 DivisionOp
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
#define FAD_RELOP_MACRO(OP)
#define FAD_BOOL_MACRO(OP)
expr2 expr2 c c c c MaxOp
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
#define SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP)
#define SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP)
Constant expression template.
T2 base_expr_type
Typename of base-expressions.
ScalarType< value_type >::type scalar_type
Typename of scalar's (which may be different from ConstT)
T2 value_type
Typename of argument values.
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::scalar_type scalar_type_1
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
SACADO_INLINE_FUNCTION void cache() const
ExprT1::value_type value_type_1
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION int size() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT2::base_expr_type base_expr_type_2
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION int size() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
ExprT2::value_type value_type_2
Sacado::Promote< value_type_1, value_type_2 >::type value_type
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::base_expr_type base_expr_type_1
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION void cache() const
ExprT2::base_expr_type base_expr_type_2
Sacado::Promote< value_type_1, value_type_2 >::type value_type
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION void cache() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT2::scalar_type scalar_type_2
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION int size() const
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT1::value_type value_type_1
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION const value_type val() const
ExprT2::value_type value_type_2
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
ExprT1::base_expr_type base_expr_type_1
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION const value_type val() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION bool isPassive() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
ExprT2::base_expr_type base_expr_type_2
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION void cache() const
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION bool isPassive() const
ExprT2::scalar_type scalar_type_2
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT1::scalar_type scalar_type_1
ExprT1::value_type value_type_1
ExprT2::base_expr_type base_expr_type_2
ExprT1::base_expr_type base_expr_type_1
ExprT2::value_type value_type_2
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION int size() const
ExprT1::scalar_type scalar_type_1
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::value_type value_type_1
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool isPassive() const
ExprT2::base_expr_type base_expr_type_2
ExprT1::base_expr_type base_expr_type_1
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT2::scalar_type scalar_type_2
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION void cache() const
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION int size() const
ExprT1::scalar_type scalar_type_1
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION void cache() const
ExprT2::scalar_type scalar_type_2
ExprT2::base_expr_type base_expr_type_2
ExprT1::base_expr_type base_expr_type_1
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION bool updateValue() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION bool isPassive() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION bool hasFastAccess() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT2::scalar_type scalar_type_2
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT1::value_type value_type_1
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION bool isPassive() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION const value_type dx(int i) const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION const value_type val() const
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION bool hasFastAccess() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION int size() const
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION const value_type val() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool isPassive() const
ExprT2::base_expr_type base_expr_type_2
ExprT1::value_type value_type_1
ExprT1::scalar_type scalar_type_1
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
SACADO_INLINE_FUNCTION int size() const
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION const value_type val() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION void cache() const
ExprT1::value_type value_type_1
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT1::base_expr_type base_expr_type_1
ExprT2::value_type value_type_2
Wrapper for a generic expression template.
std::ostream & operator<<(std::ostream &os, const Expr< ExprT > &x)
SimpleFad< ValueT > operator*(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
SACADO_INLINE_FUNCTION Expr< SafeSqrtOp< Expr< T > > > safe_sqrt(const Expr< T > &)
SACADO_INLINE_FUNCTION bool toBool(const Expr< ExprT > &x)
SACADO_INLINE_FUNCTION mpl::enable_if_c< ExprLevel< Expr< T1 > >::value==ExprLevel< Expr< T2 > >::value, Expr< PowerOp< Expr< T1 >, Expr< T2 > > > >::type pow(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
SACADO_INLINE_FUNCTION bool operator!(const Expr< ExprT > &expr)
SACADO_INLINE_FUNCTION T if_then_else(const Cond cond, const T &a, const T &b)
Meta-function for determining nesting with an expression.
static const unsigned value
ExprSpec< ExprT2 >::type type
ExprSpec< ExprT1 >::type type
ExprSpec< ExprT1 >::type type