33 #ifndef SACADO_FAD_OPS_HPP
34 #define SACADO_FAD_OPS_HPP
41 #define FAD_UNARYOP_MACRO(OPNAME,OP,USING,VALUE,DX,FASTACCESSDX) \
45 template <typename ExprT> \
48 template <typename ExprT> \
49 struct ExprSpec< OP<ExprT> > { \
50 typedef typename ExprSpec<ExprT>::type type; \
53 template <typename ExprT> \
54 class Expr< OP<ExprT>,ExprSpecDefault > { \
57 typedef typename ExprT::value_type value_type; \
58 typedef typename ExprT::scalar_type scalar_type; \
59 typedef typename ExprT::base_expr_type base_expr_type; \
61 SACADO_INLINE_FUNCTION \
62 explicit Expr(const ExprT& expr_) : expr(expr_) {} \
64 SACADO_INLINE_FUNCTION \
65 int size() const { return expr.size(); } \
67 SACADO_INLINE_FUNCTION \
68 bool hasFastAccess() const { return expr.hasFastAccess(); } \
70 SACADO_INLINE_FUNCTION \
71 bool isPassive() const { return expr.isPassive();} \
73 SACADO_INLINE_FUNCTION \
74 bool updateValue() const { return expr.updateValue(); } \
76 SACADO_INLINE_FUNCTION \
77 void cache() const {} \
79 SACADO_INLINE_FUNCTION \
80 value_type val() const { \
85 SACADO_INLINE_FUNCTION \
86 value_type dx(int i) const { \
91 SACADO_INLINE_FUNCTION \
92 value_type fastAccessDx(int i) const { \
94 return FASTACCESSDX; \
102 template <typename T> \
103 SACADO_INLINE_FUNCTION \
104 Expr< OP< Expr<T> > > \
105 OPNAME (const Expr<T>& expr) \
107 typedef OP< Expr<T> > expr_t; \
109 return Expr<expr_t>(expr); \
120 expr.fastAccessDx(
i))
126 -expr.fastAccessDx(
i))
131 exp(expr.val())*expr.dx(
i),
132 exp(expr.val())*expr.fastAccessDx(
i))
137 expr.dx(
i)/expr.val(),
138 expr.fastAccessDx(
i)/expr.val())
143 expr.dx(
i)/(
log(value_type(10))*expr.val()),
144 expr.fastAccessDx(
i) / (
log(value_type(10))*expr.val()))
149 expr.
dx(
i)/(value_type(2)* sqrt(expr.val())),
153 using std::cos; using std::
sin;,
155 -expr.
dx(
i)* sin(expr.val()),
159 using std::cos; using std::sin;,
161 expr.
dx(
i)* cos(expr.val()),
166 std::tan(expr.val()),
168 (value_type(1)+ tan(expr.val())* tan(expr.val())),
170 (value_type(1)+ tan(expr.val())* tan(expr.val())))
173 using std::acos; using std::sqrt;,
175 -expr.
dx(
i)/ sqrt(value_type(1)-expr.val()*expr.val()),
177 sqrt(value_type(1)-expr.val()*expr.val()))
180 using std::asin; using std::sqrt;,
182 expr.
dx(
i)/ sqrt(value_type(1)-expr.val()*expr.val()),
184 sqrt(value_type(1)-expr.val()*expr.val()))
189 expr.
dx(
i)/(value_type(1)+expr.val()*expr.val()),
193 using std::cosh; using std::
sinh;,
195 expr.
dx(
i)* sinh(expr.val()),
199 using std::cosh; using std::sinh;,
201 expr.
dx(
i)* cosh(expr.val()),
207 expr.
dx(
i)*(value_type(1)-tanh(expr.val())*tanh(expr.val())),
208 expr.
fastAccessDx(
i)*(value_type(1)-tanh(expr.val())*tanh(expr.val())))
211 using std::acosh; using std::sqrt;,
213 expr.
dx(
i)/ sqrt((expr.val()-value_type(1)) *
214 (expr.val()+value_type(1))),
216 (expr.val()+value_type(1))))
219 using std::asinh; using std::sqrt;,
221 expr.
dx(
i)/ sqrt(value_type(1)+expr.val()*expr.val()),
223 expr.val()*expr.val()))
228 expr.
dx(
i)/(value_type(1)-expr.val()*expr.val()),
230 expr.val()*expr.val()))
235 if_then_else( expr.val() >= 0, expr.
dx(
i), value_type(-expr.
dx(i)) ),
239 using std::fabs; using Sacado::if_then_else;,
241 if_then_else( expr.val() >= 0, expr.
dx(i), value_type(-expr.
dx(i)) ),
247 expr.
dx(i)/(value_type(3)*cbrt(expr.val()*expr.val())),
248 expr.
fastAccessDx(i)/(value_type(3)*cbrt(expr.val()*expr.val())))
250 #undef FAD_UNARYOP_MACRO
259 template <
typename ExprT,
bool is_simd>
262 template <
typename ExprT>
263 struct ExprSpec< SafeSqrtOp<ExprT> > {
264 typedef typename ExprSpec<ExprT>::type
type;
270 template <
typename ExprT>
271 class Expr< SafeSqrtOp<ExprT,true>,ExprSpecDefault > {
274 typedef typename ExprT::value_type
value_type;
275 typedef typename ExprT::scalar_type scalar_type;
276 typedef typename ExprT::base_expr_type base_expr_type;
279 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
282 int size()
const {
return expr.size(); }
285 bool hasFastAccess()
const {
return expr.hasFastAccess(); }
288 bool isPassive()
const {
return expr.isPassive();}
291 bool updateValue()
const {
return expr.updateValue(); }
294 void cache()
const {}
297 value_type
val()
const {
299 return sqrt(expr.val());
303 value_type
dx(
int i)
const {
326 template <
typename ExprT>
327 class Expr< SafeSqrtOp<ExprT,false>,ExprSpecDefault > {
330 typedef typename ExprT::value_type
value_type;
331 typedef typename ExprT::scalar_type scalar_type;
332 typedef typename ExprT::base_expr_type base_expr_type;
335 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
338 int size()
const {
return expr.size(); }
341 bool hasFastAccess()
const {
return expr.hasFastAccess(); }
344 bool isPassive()
const {
return expr.isPassive();}
347 bool updateValue()
const {
return expr.updateValue(); }
350 void cache()
const {}
353 value_type
val()
const {
355 return sqrt(expr.val());
359 value_type
dx(
int i)
const {
377 template <
typename T>
379 Expr< SafeSqrtOp< Expr<T> > >
382 typedef SafeSqrtOp< Expr<T> > expr_t;
384 return Expr<expr_t>(expr);
390 #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) \
394 template <typename ExprT1, typename ExprT2> \
397 template <typename ExprT1, typename ExprT2> \
398 struct ExprSpec< OP< ExprT1, ExprT2 > > { \
399 typedef typename ExprSpec<ExprT1>::type type; \
402 template <typename ExprT1, typename ExprT2> \
403 class Expr< OP< ExprT1, ExprT2 >,ExprSpecDefault > { \
407 typedef typename ExprT1::value_type value_type_1; \
408 typedef typename ExprT2::value_type value_type_2; \
409 typedef typename Sacado::Promote<value_type_1, \
410 value_type_2>::type value_type; \
412 typedef typename ExprT1::scalar_type scalar_type_1; \
413 typedef typename ExprT2::scalar_type scalar_type_2; \
414 typedef typename Sacado::Promote<scalar_type_1, \
415 scalar_type_2>::type scalar_type; \
417 typedef typename ExprT1::base_expr_type base_expr_type_1; \
418 typedef typename ExprT2::base_expr_type base_expr_type_2; \
419 typedef typename Sacado::Promote<base_expr_type_1, \
420 base_expr_type_2>::type base_expr_type; \
422 SACADO_INLINE_FUNCTION \
423 Expr(const ExprT1& expr1_, const ExprT2& expr2_) : \
424 expr1(expr1_), expr2(expr2_) {} \
426 SACADO_INLINE_FUNCTION \
428 int sz1 = expr1.size(), sz2 = expr2.size(); \
429 return sz1 > sz2 ? sz1 : sz2; \
432 SACADO_INLINE_FUNCTION \
433 bool hasFastAccess() const { \
434 return expr1.hasFastAccess() && expr2.hasFastAccess(); \
437 SACADO_INLINE_FUNCTION \
438 bool isPassive() const { \
439 return expr1.isPassive() && expr2.isPassive(); \
442 SACADO_INLINE_FUNCTION \
443 bool updateValue() const { \
444 return expr1.updateValue() && expr2.updateValue(); \
447 SACADO_INLINE_FUNCTION \
448 void cache() const {} \
450 SACADO_INLINE_FUNCTION \
451 const value_type val() const { \
456 SACADO_INLINE_FUNCTION \
457 const value_type dx(int i) const { \
462 SACADO_INLINE_FUNCTION \
463 const value_type fastAccessDx(int i) const { \
465 return FASTACCESSDX; \
470 const ExprT1& expr1; \
471 const ExprT2& expr2; \
475 template <typename ExprT1, typename T2> \
476 struct ExprSpec< OP< ExprT1, ConstExpr<T2> > > { \
477 typedef typename ExprSpec<ExprT1>::type type; \
480 template <typename ExprT1, typename T2> \
481 class Expr< OP< ExprT1, ConstExpr<T2> >,ExprSpecDefault > { \
485 typedef ConstExpr<T2> ConstT; \
486 typedef ConstExpr<T2> ExprT2; \
487 typedef typename ExprT1::value_type value_type_1; \
488 typedef typename ExprT2::value_type value_type_2; \
489 typedef typename Sacado::Promote<value_type_1, \
490 value_type_2>::type value_type; \
492 typedef typename ExprT1::scalar_type scalar_type_1; \
493 typedef typename ExprT2::scalar_type scalar_type_2; \
494 typedef typename Sacado::Promote<scalar_type_1, \
495 scalar_type_2>::type scalar_type; \
497 typedef typename ExprT1::base_expr_type base_expr_type_1; \
498 typedef typename ExprT2::base_expr_type base_expr_type_2; \
499 typedef typename Sacado::Promote<base_expr_type_1, \
500 base_expr_type_2>::type base_expr_type; \
502 SACADO_INLINE_FUNCTION \
503 Expr(const ExprT1& expr1_, const ConstT& c_) : \
504 expr1(expr1_), c(c_) {} \
506 SACADO_INLINE_FUNCTION \
508 return expr1.size(); \
511 SACADO_INLINE_FUNCTION \
512 bool hasFastAccess() const { \
513 return expr1.hasFastAccess(); \
516 SACADO_INLINE_FUNCTION \
517 bool isPassive() const { \
518 return expr1.isPassive(); \
521 SACADO_INLINE_FUNCTION \
522 bool updateValue() const { return expr1.updateValue(); } \
524 SACADO_INLINE_FUNCTION \
525 void cache() const {} \
527 SACADO_INLINE_FUNCTION \
528 const value_type val() const { \
530 return VAL_CONST_DX_2; \
533 SACADO_INLINE_FUNCTION \
534 const value_type dx(int i) const { \
539 SACADO_INLINE_FUNCTION \
540 const value_type fastAccessDx(int i) const { \
542 return CONST_FASTACCESSDX_2; \
547 const ExprT1& expr1; \
551 template <typename T1, typename ExprT2> \
552 struct ExprSpec< OP< ConstExpr<T1>, ExprT2 > > { \
553 typedef typename ExprSpec<ExprT2>::type type; \
556 template <typename T1, typename ExprT2> \
557 class Expr< OP< ConstExpr<T1>, ExprT2 >,ExprSpecDefault > { \
561 typedef ConstExpr<T1> ConstT; \
562 typedef ConstExpr<T1> ExprT1; \
563 typedef typename ExprT1::value_type value_type_1; \
564 typedef typename ExprT2::value_type value_type_2; \
565 typedef typename Sacado::Promote<value_type_1, \
566 value_type_2>::type value_type; \
568 typedef typename ExprT1::scalar_type scalar_type_1; \
569 typedef typename ExprT2::scalar_type scalar_type_2; \
570 typedef typename Sacado::Promote<scalar_type_1, \
571 scalar_type_2>::type scalar_type; \
573 typedef typename ExprT1::base_expr_type base_expr_type_1; \
574 typedef typename ExprT2::base_expr_type base_expr_type_2; \
575 typedef typename Sacado::Promote<base_expr_type_1, \
576 base_expr_type_2>::type base_expr_type; \
579 SACADO_INLINE_FUNCTION \
580 Expr(const ConstT& c_, const ExprT2& expr2_) : \
581 c(c_), expr2(expr2_) {} \
583 SACADO_INLINE_FUNCTION \
585 return expr2.size(); \
588 SACADO_INLINE_FUNCTION \
589 bool hasFastAccess() const { \
590 return expr2.hasFastAccess(); \
593 SACADO_INLINE_FUNCTION \
594 bool isPassive() const { \
595 return expr2.isPassive(); \
598 SACADO_INLINE_FUNCTION \
599 bool updateValue() const { return expr2.updateValue(); } \
601 SACADO_INLINE_FUNCTION \
602 void cache() const {} \
604 SACADO_INLINE_FUNCTION \
605 const value_type val() const { \
607 return VAL_CONST_DX_1; \
610 SACADO_INLINE_FUNCTION \
611 const value_type dx(int i) const { \
616 SACADO_INLINE_FUNCTION \
617 const value_type fastAccessDx(int i) const { \
619 return CONST_FASTACCESSDX_1; \
625 const ExprT2& expr2; \
628 template <typename T1, typename T2> \
629 SACADO_INLINE_FUNCTION \
630 typename mpl::enable_if_c< \
631 ExprLevel< Expr<T1> >::value == ExprLevel< Expr<T2> >::value, \
632 Expr< OP< Expr<T1>, Expr<T2> > > \
635 OPNAME (const Expr<T1>& expr1, const Expr<T2>& expr2) \
637 typedef OP< Expr<T1>, Expr<T2> > expr_t; \
639 return Expr<expr_t>(expr1, expr2); \
642 template <typename T> \
643 SACADO_INLINE_FUNCTION \
644 Expr< OP< Expr<T>, Expr<T> > > \
645 OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
647 typedef OP< Expr<T>, Expr<T> > expr_t; \
649 return Expr<expr_t>(expr1, expr2); \
652 template <typename T> \
653 SACADO_INLINE_FUNCTION \
654 Expr< OP< ConstExpr<typename Expr<T>::value_type>, \
656 OPNAME (const typename Expr<T>::value_type& c, \
657 const Expr<T>& expr) \
659 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
660 typedef OP< ConstT, Expr<T> > expr_t; \
662 return Expr<expr_t>(ConstT(c), expr); \
665 template <typename T> \
666 SACADO_INLINE_FUNCTION \
668 ConstExpr<typename Expr<T>::value_type> > > \
669 OPNAME (const Expr<T>& expr, \
670 const typename Expr<T>::value_type& c) \
672 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
673 typedef OP< Expr<T>, ConstT > expr_t; \
675 return Expr<expr_t>(expr, ConstT(c)); \
678 template <typename T> \
679 SACADO_INLINE_FUNCTION \
680 SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
681 OPNAME (const typename Expr<T>::scalar_type& c, \
682 const Expr<T>& expr) \
684 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
685 typedef OP< ConstT, Expr<T> > expr_t; \
687 return Expr<expr_t>(ConstT(c), expr); \
690 template <typename T> \
691 SACADO_INLINE_FUNCTION \
692 SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
693 OPNAME (const Expr<T>& expr, \
694 const typename Expr<T>::scalar_type& c) \
696 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
697 typedef OP< Expr<T>, ConstT > expr_t; \
699 return Expr<expr_t>(expr, ConstT(c)); \
709 expr1.val() + expr2.val(),
710 expr1.dx(i) + expr2.dx(i),
711 expr1.fastAccessDx(i) + expr2.fastAccessDx(i),
712 c.val() + expr2.val(),
713 expr1.val() +
c.val(),
716 expr2.fastAccessDx(i),
717 expr1.fastAccessDx(i))
721 expr1.val() - expr2.val(),
722 expr1.dx(i) - expr2.dx(i),
723 expr1.fastAccessDx(i) - expr2.fastAccessDx(i),
724 c.val() - expr2.val(),
725 expr1.val() -
c.val(),
728 -expr2.fastAccessDx(i),
729 expr1.fastAccessDx(i))
746 expr1.val() / expr2.val(),
747 (expr1.dx(i)*expr2.val() - expr2.dx(i)*expr1.val()) /
748 (expr2.val()*expr2.val()),
749 (expr1.fastAccessDx(i)*expr2.val() -
750 expr2.fastAccessDx(i)*expr1.val()) /
751 (expr2.val()*expr2.val()),
752 c.val() / expr2.val(),
753 expr1.val() /
c.val(),
754 -expr2.dx(i)*
c.val() / (expr2.val()*expr2.val()),
756 -expr2.fastAccessDx(i)*
c.val() / (expr2.val()*expr2.val()),
757 expr1.fastAccessDx(i)/
c.val())
761 atan2(expr1.val(), expr2.val()),
762 (expr2.val()*expr1.dx(i) - expr1.val()*expr2.dx(i))/
763 (expr1.val()*expr1.val() + expr2.val()*expr2.val()),
764 (expr2.val()*expr1.fastAccessDx(i) - expr1.val()*expr2.fastAccessDx(i))/
765 (expr1.val()*expr1.val() + expr2.val()*expr2.val()),
766 atan2(
c.val(), expr2.val()),
767 atan2(expr1.val(),
c.val()),
768 (-
c.val()*expr2.dx(i)) / (
c.val()*
c.val() + expr2.val()*expr2.val()),
769 (
c.val()*expr1.dx(i))/ (expr1.val()*expr1.val() +
c.val()*
c.val()),
770 (-
c.val()*expr2.fastAccessDx(i))/ (
c.val()*
c.val() + expr2.val()*expr2.val()),
771 (
c.val()*expr1.fastAccessDx(i))/ (expr1.val()*expr1.val() +
c.val()*
c.val()))
786 using Sacado::if_then_else;,
787 if_then_else( expr1.val() >= expr2.val(), expr1.val(), expr2.val() ),
788 if_then_else( expr1.val() >= expr2.val(), expr1.
dx(i), expr2.
dx(i) ),
790 if_then_else(
c.val() >= expr2.val(), value_type(
c.val()), expr2.val() ),
791 if_then_else( expr1.val() >=
c.val(), expr1.val(), value_type(
c.val()) ),
792 if_then_else(
c.val() >= expr2.val(), value_type(0.0), expr2.
dx(i) ),
793 if_then_else( expr1.val() >=
c.val(), expr1.
dx(i), value_type(0.0) ),
794 if_then_else(
c.val() >= expr2.val(), value_type(0.0), expr2.
fastAccessDx(i) ),
795 if_then_else( expr1.val() >=
c.val(), expr1.
fastAccessDx(i), value_type(0.0) ) )
798 using Sacado::if_then_else;,
799 if_then_else( expr1.val() <= expr2.val(), expr1.val(), expr2.val() ),
800 if_then_else( expr1.val() <= expr2.val(), expr1.
dx(i), expr2.
dx(i) ),
802 if_then_else(
c.val() <= expr2.val(), value_type(
c.val()), expr2.val() ),
803 if_then_else( expr1.val() <=
c.val(), expr1.val(), value_type(
c.val()) ),
804 if_then_else(
c.val() <= expr2.val(), value_type(0), expr2.
dx(i) ),
805 if_then_else( expr1.val() <=
c.val(), expr1.
dx(i), value_type(0) ),
806 if_then_else(
c.val() <= expr2.val(), value_type(0), expr2.
fastAccessDx(i) ),
807 if_then_else( expr1.val() <=
c.val(), expr1.
fastAccessDx(i), value_type(0) ) )
810 #undef FAD_BINARYOP_MACRO
815 template <
typename ExprT1,
typename ExprT2>
818 template <
typename ExprT1,
typename ExprT2>
819 struct ExprSpec< MultiplicationOp< ExprT1, ExprT2 > > {
820 typedef typename ExprSpec<ExprT1>::type
type;
823 template <
typename ExprT1,
typename ExprT2>
824 class Expr< MultiplicationOp< ExprT1, ExprT2 >,ExprSpecDefault > {
828 typedef typename ExprT1::value_type value_type_1;
829 typedef typename ExprT2::value_type value_type_2;
833 typedef typename ExprT1::scalar_type scalar_type_1;
834 typedef typename ExprT2::scalar_type scalar_type_2;
836 scalar_type_2>::type scalar_type;
838 typedef typename ExprT1::base_expr_type base_expr_type_1;
839 typedef typename ExprT2::base_expr_type base_expr_type_2;
841 base_expr_type_2>::type base_expr_type;
844 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
845 expr1(expr1_), expr2(expr2_) {}
849 int sz1 = expr1.size(), sz2 = expr2.size();
850 return sz1 > sz2 ? sz1 : sz2;
854 bool hasFastAccess()
const {
855 return expr1.hasFastAccess() && expr2.hasFastAccess();
859 bool isPassive()
const {
860 return expr1.isPassive() && expr2.isPassive();
864 bool updateValue()
const {
865 return expr1.updateValue() && expr2.updateValue();
869 void cache()
const {}
872 const value_type
val()
const {
873 return expr1.val()*expr2.val();
877 const value_type
dx(
int i)
const {
878 if (expr1.size() > 0 && expr2.size() > 0)
879 return expr1.val()*expr2.dx(i) + expr1.dx(i)*expr2.val();
880 else if (expr1.size() > 0)
881 return expr1.dx(i)*expr2.val();
883 return expr1.val()*expr2.dx(i);
888 return expr1.val()*expr2.fastAccessDx(i) +
889 expr1.fastAccessDx(i)*expr2.val();
899 template <
typename ExprT1,
typename T2>
900 struct ExprSpec< MultiplicationOp< ExprT1, ConstExpr<T2> > > {
901 typedef typename ExprSpec<ExprT1>::type
type;
904 template <
typename ExprT1,
typename T2>
905 class Expr< MultiplicationOp< ExprT1, ConstExpr<T2> >,ExprSpecDefault > {
909 typedef ConstExpr<T2> ConstT;
910 typedef ConstExpr<T2> ExprT2;
911 typedef typename ExprT1::value_type value_type_1;
912 typedef typename ExprT2::value_type value_type_2;
916 typedef typename ExprT1::scalar_type scalar_type_1;
917 typedef typename ExprT2::scalar_type scalar_type_2;
919 scalar_type_2>::type scalar_type;
921 typedef typename ExprT1::base_expr_type base_expr_type_1;
922 typedef typename ExprT2::base_expr_type base_expr_type_2;
924 base_expr_type_2>::type base_expr_type;
927 Expr(
const ExprT1& expr1_,
const ConstT&
c_) :
928 expr1(expr1_),
c(c_) {}
936 bool hasFastAccess()
const {
937 return expr1.hasFastAccess();
941 bool isPassive()
const {
942 return expr1.isPassive();
946 bool updateValue()
const {
return expr1.updateValue(); }
949 void cache()
const {}
952 const value_type
val()
const {
953 return expr1.val()*
c.val();
957 const value_type
dx(
int i)
const {
958 return expr1.dx(i)*
c.val();
963 return expr1.fastAccessDx(i)*
c.val();
972 template <
typename T1,
typename ExprT2>
973 struct ExprSpec< MultiplicationOp< ConstExpr<T1>, ExprT2 > > {
974 typedef typename ExprSpec<ExprT2>::type
type;
977 template <
typename T1,
typename ExprT2>
978 class Expr< MultiplicationOp< ConstExpr<T1>, ExprT2 >,ExprSpecDefault > {
982 typedef ConstExpr<T1> ConstT;
983 typedef ConstExpr<T1> ExprT1;
984 typedef typename ExprT1::value_type value_type_1;
985 typedef typename ExprT2::value_type value_type_2;
989 typedef typename ExprT1::scalar_type scalar_type_1;
990 typedef typename ExprT2::scalar_type scalar_type_2;
992 scalar_type_2>::type scalar_type;
994 typedef typename ExprT1::base_expr_type base_expr_type_1;
995 typedef typename ExprT2::base_expr_type base_expr_type_2;
997 base_expr_type_2>::type base_expr_type;
1000 Expr(
const ConstT&
c_,
const ExprT2& expr2_) :
1001 c(c_), expr2(expr2_) {}
1005 return expr2.size();
1009 bool hasFastAccess()
const {
1010 return expr2.hasFastAccess();
1014 bool isPassive()
const {
1015 return expr2.isPassive();
1019 bool updateValue()
const {
return expr2.updateValue(); }
1022 void cache()
const {}
1025 const value_type
val()
const {
1026 return c.val()*expr2.val();
1030 const value_type
dx(
int i)
const {
1031 return c.val()*expr2.dx(i);
1036 return c.val()*expr2.fastAccessDx(i);
1042 const ExprT2& expr2;
1045 template <
typename T1,
typename T2>
1047 typename mpl::enable_if_c<
1049 Expr< MultiplicationOp< Expr<T1>, Expr<T2> > >
1052 operator* (
const Expr<T1>& expr1,
const Expr<T2>& expr2)
1054 typedef MultiplicationOp< Expr<T1>, Expr<T2> > expr_t;
1056 return Expr<expr_t>(expr1, expr2);
1059 template <
typename T>
1061 Expr< MultiplicationOp< Expr<T>, Expr<T> > >
1062 operator* (
const Expr<T>& expr1,
const Expr<T>& expr2)
1064 typedef MultiplicationOp< Expr<T>, Expr<T> > expr_t;
1066 return Expr<expr_t>(expr1, expr2);
1069 template <
typename T>
1071 Expr< MultiplicationOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
1072 operator* (
const typename Expr<T>::value_type&
c,
1073 const Expr<T>& expr)
1075 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1076 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
1078 return Expr<expr_t>(ConstT(c), expr);
1081 template <
typename T>
1083 Expr< MultiplicationOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
1085 const typename Expr<T>::value_type& c)
1087 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1088 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
1090 return Expr<expr_t>(expr, ConstT(c));
1093 template <
typename T>
1096 operator* (
const typename Expr<T>::scalar_type& c,
1097 const Expr<T>& expr)
1099 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1100 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
1102 return Expr<expr_t>(ConstT(c), expr);
1105 template <
typename T>
1109 const typename Expr<T>::scalar_type& c)
1111 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1112 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
1114 return Expr<expr_t>(expr, ConstT(c));
1126 template <
typename ExprT1,
typename ExprT2,
typename Impl>
1129 template <
typename ExprT1,
typename ExprT2>
1134 template <
typename ExprT1,
typename T2>
1139 template <
typename T1,
typename ExprT2>
1147 template <
typename ExprT1,
typename ExprT2>
1168 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1169 expr1(expr1_), expr2(expr2_) {}
1173 int sz1 = expr1.size(), sz2 = expr2.size();
1174 return sz1 > sz2 ? sz1 : sz2;
1179 return expr1.hasFastAccess() && expr2.hasFastAccess();
1184 return expr1.isPassive() && expr2.isPassive();
1189 return expr1.updateValue() && expr2.updateValue();
1196 const value_type
val()
const {
1198 return pow(expr1.val(), expr2.val());
1202 const value_type
dx(
int i)
const {
1204 const int sz1 = expr1.size(), sz2 = expr2.size();
1205 if (sz1 > 0 && sz2 > 0)
1228 template <
typename ExprT1,
typename T2>
1253 expr1(expr1_),
c(c_) {}
1257 return expr1.size();
1262 return expr1.hasFastAccess();
1267 return expr1.isPassive();
1277 const value_type
val()
const {
1279 return pow(expr1.val(),
c.val());
1283 const value_type
dx(
int i)
const {
1304 template <
typename T1,
typename ExprT2>
1330 c(c_), expr2(expr2_) {}
1334 return expr2.size();
1339 return expr2.hasFastAccess();
1344 return expr2.isPassive();
1354 const value_type
val()
const {
1356 return pow(
c.val(), expr2.val());
1360 const value_type
dx(
int i)
const {
1381 template <
typename ExprT1,
typename ExprT2>
1403 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1404 expr1(expr1_), expr2(expr2_) {}
1408 int sz1 = expr1.size(), sz2 = expr2.size();
1409 return sz1 > sz2 ? sz1 : sz2;
1414 return expr1.hasFastAccess() && expr2.hasFastAccess();
1419 return expr1.isPassive() && expr2.isPassive();
1424 return expr1.updateValue() && expr2.updateValue();
1431 const value_type
val()
const {
1433 return pow(expr1.val(), expr2.val());
1437 const value_type
dx(
int i)
const {
1439 const int sz1 = expr1.size(), sz2 = expr2.size();
1440 if (sz1 > 0 && sz2 > 0)
1453 return expr1.val() ==
scalar_type(0.0) ?
value_type(0.0) :
value_type((expr2.fastAccessDx(i)*
log(expr1.val())+expr2.val()*expr1.fastAccessDx(i)/expr1.val())*
pow(expr1.val(),expr2.val()));
1463 template <
typename ExprT1,
typename T2>
1488 expr1(expr1_),
c(c_) {}
1492 return expr1.size();
1497 return expr1.hasFastAccess();
1502 return expr1.isPassive();
1512 const value_type
val()
const {
1514 return pow(expr1.val(),
c.val());
1518 const value_type
dx(
int i)
const {
1539 template <
typename T1,
typename ExprT2>
1565 c(c_), expr2(expr2_) {}
1569 return expr2.size();
1574 return expr2.hasFastAccess();
1579 return expr2.isPassive();
1589 const value_type
val()
const {
1591 return pow(
c.val(), expr2.val());
1595 const value_type
dx(
int i)
const {
1617 template <
typename ExprT1,
typename ExprT2>
1639 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1640 expr1(expr1_), expr2(expr2_) {}
1644 int sz1 = expr1.size(), sz2 = expr2.size();
1645 return sz1 > sz2 ? sz1 : sz2;
1650 return expr1.hasFastAccess() && expr2.hasFastAccess();
1655 return expr1.isPassive() && expr2.isPassive();
1660 return expr1.updateValue() && expr2.updateValue();
1667 const value_type
val()
const {
1669 return pow(expr1.val(), expr2.val());
1673 const value_type
dx(
int i)
const {
1675 const int sz1 = expr1.size(), sz2 = expr2.size();
1676 if (sz1 > 0 && sz2 > 0)
1677 return (expr2.dx(i)*
log(expr1.val())+expr2.val()*expr1.dx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1681 return expr2.dx(i)*
log(expr1.val())*
pow(expr1.val(),expr2.val());
1687 return (expr2.fastAccessDx(i)*
log(expr1.val())+expr2.val()*expr1.fastAccessDx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1697 template <
typename ExprT1,
typename T2>
1722 expr1(expr1_),
c(c_) {}
1726 return expr1.size();
1731 return expr1.hasFastAccess();
1736 return expr1.isPassive();
1746 const value_type
val()
const {
1748 return pow(expr1.val(),
c.val());
1752 const value_type
dx(
int i)
const {
1769 template <
typename T1,
typename ExprT2>
1795 c(c_), expr2(expr2_) {}
1799 return expr2.size();
1804 return expr2.hasFastAccess();
1809 return expr2.isPassive();
1819 const value_type
val()
const {
1821 return pow(
c.val(), expr2.val());
1825 const value_type
dx(
int i)
const {
1827 return expr2.dx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
1833 return expr2.fastAccessDx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
1847 template <
typename ExprT1,
typename ExprT2>
1869 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1870 expr1(expr1_), expr2(expr2_) {}
1874 int sz1 = expr1.size(), sz2 = expr2.size();
1875 return sz1 > sz2 ? sz1 : sz2;
1880 return expr1.hasFastAccess() && expr2.hasFastAccess();
1885 return expr1.isPassive() && expr2.isPassive();
1890 return expr1.updateValue() && expr2.updateValue();
1897 const value_type
val()
const {
1899 return pow(expr1.val(), expr2.val());
1903 const value_type
dx(
int i)
const {
1905 const int sz1 = expr1.size(), sz2 = expr2.size();
1906 if (sz1 > 0 && sz2 > 0)
1907 return (expr2.dx(i)*
log(expr1.val())+expr2.val()*expr1.dx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1911 return expr2.dx(i)*
log(expr1.val())*
pow(expr1.val(),expr2.val());
1917 return (expr2.fastAccessDx(i)*
log(expr1.val())+expr2.val()*expr1.fastAccessDx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1927 template <
typename ExprT1,
typename T2>
1952 expr1(expr1_),
c(c_) {}
1956 return expr1.size();
1961 return expr1.hasFastAccess();
1966 return expr1.isPassive();
1976 const value_type
val()
const {
1978 return pow(expr1.val(),
c.val());
1982 const value_type
dx(
int i)
const {
1999 template <
typename T1,
typename ExprT2>
2025 c(c_), expr2(expr2_) {}
2029 return expr2.size();
2034 return expr2.hasFastAccess();
2039 return expr2.isPassive();
2049 const value_type
val()
const {
2051 return pow(
c.val(), expr2.val());
2055 const value_type
dx(
int i)
const {
2057 return expr2.dx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
2063 return expr2.fastAccessDx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
2072 template <
typename T1,
typename T2>
2086 template <
typename T>
2088 Expr< PowerOp< Expr<T>, Expr<T> > >
2096 template <
typename T>
2098 Expr< PowerOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
2108 template <
typename T>
2110 Expr< PowerOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
2120 template <
typename T>
2124 const
Expr<
T>& expr)
2132 template <
typename T>
2136 const typename
Expr<
T>::scalar_type&
c)
2154 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2157 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2162 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2183 Expr(
const CondT& cond_,
const ExprT1& expr1_,
const ExprT2& expr2_) :
2184 cond(cond_), expr1(expr1_), expr2(expr2_) {}
2188 int sz1 = expr1.size(), sz2 = expr2.size();
2189 return sz1 > sz2 ? sz1 : sz2;
2194 return expr1.hasFastAccess() && expr2.hasFastAccess();
2199 return expr1.isPassive() && expr2.isPassive();
2204 return expr1.updateValue() && expr2.updateValue();
2211 const value_type
val()
const {
2217 const value_type
dx(
int i)
const {
2225 return if_then_else( cond, expr1.fastAccessDx(i), expr2.fastAccessDx(i) );
2236 template <
typename CondT,
typename ExprT1,
typename T2>
2241 template <
typename CondT,
typename ExprT1,
typename T2>
2265 cond(cond_), expr1(expr1_),
c(c_) {}
2269 return expr1.size();
2274 return expr1.hasFastAccess();
2279 return expr1.isPassive();
2289 const value_type
val()
const {
2295 const value_type
dx(
int i)
const {
2313 template <
typename CondT,
typename T1,
typename ExprT2>
2318 template <
typename CondT,
typename T1,
typename ExprT2>
2342 cond(cond_),
c(c_), expr2(expr2_) {}
2346 return expr2.size();
2351 return expr2.hasFastAccess();
2356 return expr2.isPassive();
2366 const value_type
val()
const {
2372 const value_type
dx(
int i)
const {
2390 template <
typename CondT,
typename T1,
typename T2>
2403 template <
typename CondT,
typename T>
2405 Expr< IfThenElseOp< CondT, Expr<T>, Expr<T> > >
2413 template <
typename CondT,
typename T>
2415 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::value_type>,
2426 template <
typename CondT,
typename T>
2428 Expr< IfThenElseOp< CondT, Expr<T>,
2429 ConstExpr<typename Expr<T>::value_type> > >
2439 template <
typename CondT,
typename T>
2442 std::is_same< typename Expr<T>::value_type,
2443 typename Expr<T>::scalar_type>,
2444 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::scalar_type>,
2456 template <
typename CondT,
typename T>
2459 std::is_same< typename Expr<T>::value_type,
2460 typename Expr<T>::scalar_type>,
2461 Expr< IfThenElseOp< CondT, Expr<T>,
2462 ConstExpr<typename Expr<T>::scalar_type> > >
2479 template <
typename T1,
typename T2 = T1>
2481 typedef decltype( std::declval<T1>() == std::declval<T2>() )
type;
2486 #define FAD_RELOP_MACRO(OP) \
2487 namespace Sacado { \
2489 template <typename ExprT1, typename ExprT2> \
2490 SACADO_INLINE_FUNCTION \
2491 typename ConditionalReturnType<typename Expr<ExprT1>::value_type, \
2492 typename Expr<ExprT2>::value_type>::type \
2493 operator OP (const Expr<ExprT1>& expr1, \
2494 const Expr<ExprT2>& expr2) \
2496 return expr1.val() OP expr2.val(); \
2499 template <typename ExprT2> \
2500 SACADO_INLINE_FUNCTION \
2501 typename ConditionalReturnType<typename Expr<ExprT2>::value_type>::type \
2502 operator OP (const typename Expr<ExprT2>::value_type& a, \
2503 const Expr<ExprT2>& expr2) \
2505 return a OP expr2.val(); \
2508 template <typename ExprT1> \
2509 SACADO_INLINE_FUNCTION \
2510 typename ConditionalReturnType<typename Expr<ExprT1>::value_type>::type \
2511 operator OP (const Expr<ExprT1>& expr1, \
2512 const typename Expr<ExprT1>::value_type& b) \
2514 return expr1.val() OP b; \
2530 #undef FAD_RELOP_MACRO
2536 template <
typename ExprT>
2540 return ! expr.val();
2552 template <
typename ExprT>
2555 bool is_zero = (x.val() == 0.0);
2556 for (
int i=0; i<x.size(); i++)
2557 is_zero = is_zero && (x.dx(i) == 0.0);
2565 #define FAD_BOOL_MACRO(OP) \
2566 namespace Sacado { \
2568 template <typename ExprT1, typename ExprT2> \
2569 SACADO_INLINE_FUNCTION \
2571 operator OP (const Expr<ExprT1>& expr1, \
2572 const Expr<ExprT2>& expr2) \
2574 return toBool(expr1) OP toBool(expr2); \
2577 template <typename ExprT2> \
2578 SACADO_INLINE_FUNCTION \
2580 operator OP (const typename Expr<ExprT2>::value_type& a, \
2581 const Expr<ExprT2>& expr2) \
2583 return a OP toBool(expr2); \
2586 template <typename ExprT1> \
2587 SACADO_INLINE_FUNCTION \
2589 operator OP (const Expr<ExprT1>& expr1, \
2590 const typename Expr<ExprT1>::value_type& b) \
2592 return toBool(expr1) OP b; \
2600 #undef FAD_BOOL_MACRO
2608 template <
typename ExprT>
2609 std::ostream& operator << (std::ostream& os, const Expr<ExprT>&
x) {
2610 os <<
x.val() <<
" [";
2612 for (
int i=0; i<
x.size(); i++) {
2613 os <<
" " <<
x.dx(i);
2624 #endif // SACADO_FAD_OPS_HPP
ExprT2::value_type value_type_2
ExprSpec< ExprT1 >::type type
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT2::base_expr_type base_expr_type_2
Wrapper for a generic expression template.
ExprT1::value_type value_type_1
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION bool isPassive() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT2::scalar_type scalar_type_2
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ScalarType< value_type >::type scalar_type
Typename of scalar's (which may be different from ConstT)
Constant expression template.
SACADO_INLINE_FUNCTION void cache() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT2::value_type value_type_2
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
SACADO_INLINE_FUNCTION Expr(const CondT &cond_, const ConstT &c_, const ExprT2 &expr2_)
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION int size() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
#define FAD_UNARYOP_MACRO(OPNAME, OP, USING, VALUE, DX, FASTACCESSDX)
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION const value_type val() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION void cache() const
ExprT2::base_expr_type base_expr_type_2
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT2::scalar_type scalar_type_2
ExprT1::scalar_type scalar_type_1
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT1::scalar_type scalar_type_1
ExprSpec< ExprT2 >::type type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT1::value_type value_type_1
ExprT2::base_expr_type base_expr_type_2
ExprT2::base_expr_type base_expr_type_2
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION bool isPassive() const
ExprT1::scalar_type scalar_type_1
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION Expr< SafeSqrtOp< Expr< T > > > safe_sqrt(const Expr< T > &)
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT2::base_expr_type base_expr_type_2
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION bool hasFastAccess() 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 bool isPassive() const
SACADO_INLINE_FUNCTION bool updateValue() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
ExprT2::scalar_type scalar_type_2
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION bool isPassive() const
ExprT2::base_expr_type base_expr_type_2
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT1::value_type value_type_1
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< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT2::scalar_type scalar_type_2
ExprT2::base_expr_type base_expr_type_2
#define SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP)
SimpleFad< ValueT > sqrt(const SimpleFad< ValueT > &a)
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION Expr(const CondT &cond_, const ExprT1 &expr1_, const ConstT &c_)
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION const value_type val() const
ExprT1::scalar_type scalar_type_1
ExprT2::scalar_type scalar_type_2
decltype(std::declval< T1 >()==std::declval< T2 >()) typedef type
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION mpl::enable_if_c< IsFadExpr< T1 >::value &&IsFadExpr< T2 >::value &&ExprLevel< T1 >::value==ExprLevel< T2 >::value, Expr< IfThenElseOp< CondT, T1, T2 > > >::type if_then_else(const CondT &cond, const T1 &expr1, const T2 &expr2)
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT1::value_type value_type_1
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION int size() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION bool isPassive() const
ExprT1::base_expr_type base_expr_type_1
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION void cache() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
Sacado::Promote< value_type_1, value_type_2 >::type value_type
expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 MultiplicationOp
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
ExprT1::scalar_type scalar_type_1
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
ExprT2::scalar_type scalar_type_2
ExprT2::base_expr_type base_expr_type_2
ExprSpec< ExprT1 >::type type
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION bool isPassive() const
SimpleFad< ValueT > log(const SimpleFad< ValueT > &a)
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 expr1 expr1 c *expr2 expr1 c *expr2 expr1 c *expr2 expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 Atan2Op
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool toBool(const Expr< ExprT > &x)
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::base_expr_type base_expr_type_1
ExprT1::base_expr_type base_expr_type_1
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT2::value_type value_type_2
Determine whether a given type is an expression.
SACADO_INLINE_FUNCTION const value_type val() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
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
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
#define FAD_BINARYOP_MACRO(OPNAME, OP, USING, VALUE, DX, CDX1, CDX2, FASTACCESSDX, VAL_CONST_DX_1, VAL_CONST_DX_2, CONST_DX_1, CONST_DX_2, CONST_FASTACCESSDX_1, CONST_FASTACCESSDX_2)
ExprT2::scalar_type scalar_type_2
ExprT1::scalar_type scalar_type_1
ExprT1::base_expr_type base_expr_type_1
#define FAD_BOOL_MACRO(OP)
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION Expr(const CondT &cond_, const ExprT1 &expr1_, const ExprT2 &expr2_)
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION const value_type val() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION T if_then_else(const Cond cond, const T &a, const T &b)
SimpleFad< ValueT > min(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
ExprT1::base_expr_type base_expr_type_1
Sacado::Promote< value_type_1, value_type_2 >::type value_type
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION int size() const
ExprT1::value_type value_type_1
ExprSpec< ExprT2 >::type type
ExprT2::base_expr_type base_expr_type_2
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION int size() const
expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 expr1 expr1 c *expr2 expr1 c *expr2 expr1 c *expr2 expr1 DivisionOp
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT2::value_type value_type_2
ExprT2::base_expr_type base_expr_type_2
ExprT1::value_type value_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 bool updateValue() const
SACADO_INLINE_FUNCTION bool updateValue() const
T2 base_expr_type
Typename of base-expressions.
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION bool isPassive() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION void cache() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
atan2(expr1.val(), expr2.val())
Meta-function for determining nesting with an expression.
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT1::scalar_type scalar_type_1
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::base_expr_type base_expr_type_1
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
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
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION const value_type val() const
#define SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP)
SACADO_INLINE_FUNCTION const value_type dx(int i) const
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION bool operator!(const Expr< ExprT > &expr)
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprSpec< ExprT1 >::type type
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
ExprT2::value_type value_type_2
ExprT1::base_expr_type base_expr_type_1
ExprT2::base_expr_type base_expr_type_2
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION void cache() const
SimpleFad< ValueT > operator*(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
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_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
if_then_else(expr.val() >=0, expr.dx(i), value_type(-expr.dx(i)))
SimpleFad< ValueT > max(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
SACADO_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
T2 value_type
Typename of argument values.
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION const value_type val() const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
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 const value_type dx(int i) const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool updateValue() const
#define FAD_RELOP_MACRO(OP)
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION const value_type val() const
ExprT1::base_expr_type base_expr_type_1
SACADO_INLINE_FUNCTION void cache() const
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION int size() const
#define SACADO_INLINE_FUNCTION
ExprT1::base_expr_type base_expr_type_1
ExprT1::scalar_type scalar_type_1
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION int size() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION const value_type val() const
ExprT1::scalar_type scalar_type_1
ExprT1::scalar_type scalar_type_1
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprSpec< ExprT1 >::type type
ExprT2::scalar_type scalar_type_2
ExprT2::scalar_type scalar_type_2
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT1::scalar_type scalar_type_1
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION bool isPassive() const
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT2::value_type value_type_2
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION const value_type val() const
SACADO_INLINE_FUNCTION const value_type val() const
ExprT1::base_expr_type base_expr_type_1
ExprT2::scalar_type scalar_type_2
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION void cache() const
ExprT1::value_type value_type_1
SACADO_INLINE_FUNCTION const value_type val() const
ExprT2::value_type value_type_2
ExprT2::value_type value_type_2
ExprT2::scalar_type scalar_type_2
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 PowerOp
SACADO_INLINE_FUNCTION const value_type dx(int i) const