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())
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()),
185 std::tan(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())),
227 expr.
fastAccessDx(
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()),
242 expr.val()*expr.val()))
247 expr.
dx(
i)/(value_type(1)-expr.val()*expr.val()),
249 expr.val()*expr.val()))
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)) ),
266 expr.
dx(i)/(value_type(3)*cbrt(expr.val()*expr.val())),
267 expr.
fastAccessDx(i)/(value_type(3)*cbrt(expr.val()*expr.val())))
269 #undef FAD_UNARYOP_MACRO
278 template <
typename ExprT,
bool is_simd>
281 template <
typename ExprT>
282 struct ExprSpec< SafeSqrtOp<ExprT> > {
283 typedef typename ExprSpec<ExprT>::type
type;
289 template <
typename ExprT>
290 class Expr< SafeSqrtOp<ExprT,true>,ExprSpecDefault > {
293 typedef typename ExprT::value_type
value_type;
294 typedef typename ExprT::scalar_type scalar_type;
295 typedef typename ExprT::base_expr_type base_expr_type;
298 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
301 int size()
const {
return expr.size(); }
304 bool hasFastAccess()
const {
return expr.hasFastAccess(); }
307 bool isPassive()
const {
return expr.isPassive();}
310 bool updateValue()
const {
return expr.updateValue(); }
313 void cache()
const {}
316 value_type
val()
const {
318 return sqrt(expr.val());
322 value_type
dx(
int i)
const {
345 template <
typename ExprT>
346 class Expr< SafeSqrtOp<ExprT,false>,ExprSpecDefault > {
349 typedef typename ExprT::value_type
value_type;
350 typedef typename ExprT::scalar_type scalar_type;
351 typedef typename ExprT::base_expr_type base_expr_type;
354 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
357 int size()
const {
return expr.size(); }
360 bool hasFastAccess()
const {
return expr.hasFastAccess(); }
363 bool isPassive()
const {
return expr.isPassive();}
366 bool updateValue()
const {
return expr.updateValue(); }
369 void cache()
const {}
372 value_type
val()
const {
374 return sqrt(expr.val());
378 value_type
dx(
int i)
const {
396 template <
typename T>
398 Expr< SafeSqrtOp< Expr<T> > >
401 typedef SafeSqrtOp< Expr<T> > expr_t;
403 return Expr<expr_t>(expr);
409 #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) \
413 template <typename ExprT1, typename ExprT2> \
416 template <typename ExprT1, typename ExprT2> \
417 struct ExprSpec< OP< ExprT1, ExprT2 > > { \
418 typedef typename ExprSpec<ExprT1>::type type; \
421 template <typename ExprT1, typename ExprT2> \
422 class Expr< OP< ExprT1, ExprT2 >,ExprSpecDefault > { \
426 typedef typename ExprT1::value_type value_type_1; \
427 typedef typename ExprT2::value_type value_type_2; \
428 typedef typename Sacado::Promote<value_type_1, \
429 value_type_2>::type value_type; \
431 typedef typename ExprT1::scalar_type scalar_type_1; \
432 typedef typename ExprT2::scalar_type scalar_type_2; \
433 typedef typename Sacado::Promote<scalar_type_1, \
434 scalar_type_2>::type scalar_type; \
436 typedef typename ExprT1::base_expr_type base_expr_type_1; \
437 typedef typename ExprT2::base_expr_type base_expr_type_2; \
438 typedef typename Sacado::Promote<base_expr_type_1, \
439 base_expr_type_2>::type base_expr_type; \
441 SACADO_INLINE_FUNCTION \
442 Expr(const ExprT1& expr1_, const ExprT2& expr2_) : \
443 expr1(expr1_), expr2(expr2_) {} \
445 SACADO_INLINE_FUNCTION \
447 int sz1 = expr1.size(), sz2 = expr2.size(); \
448 return sz1 > sz2 ? sz1 : sz2; \
451 SACADO_INLINE_FUNCTION \
452 bool hasFastAccess() const { \
453 return expr1.hasFastAccess() && expr2.hasFastAccess(); \
456 SACADO_INLINE_FUNCTION \
457 bool isPassive() const { \
458 return expr1.isPassive() && expr2.isPassive(); \
461 SACADO_INLINE_FUNCTION \
462 bool updateValue() const { \
463 return expr1.updateValue() && expr2.updateValue(); \
466 SACADO_INLINE_FUNCTION \
467 void cache() const {} \
469 SACADO_INLINE_FUNCTION \
470 const value_type val() const { \
475 SACADO_INLINE_FUNCTION \
476 const value_type dx(int i) const { \
481 SACADO_INLINE_FUNCTION \
482 const value_type fastAccessDx(int i) const { \
484 return FASTACCESSDX; \
489 const ExprT1& expr1; \
490 const ExprT2& expr2; \
494 template <typename ExprT1, typename T2> \
495 struct ExprSpec< OP< ExprT1, ConstExpr<T2> > > { \
496 typedef typename ExprSpec<ExprT1>::type type; \
499 template <typename ExprT1, typename T2> \
500 class Expr< OP< ExprT1, ConstExpr<T2> >,ExprSpecDefault > { \
504 typedef ConstExpr<T2> ConstT; \
505 typedef ConstExpr<T2> ExprT2; \
506 typedef typename ExprT1::value_type value_type_1; \
507 typedef typename ExprT2::value_type value_type_2; \
508 typedef typename Sacado::Promote<value_type_1, \
509 value_type_2>::type value_type; \
511 typedef typename ExprT1::scalar_type scalar_type_1; \
512 typedef typename ExprT2::scalar_type scalar_type_2; \
513 typedef typename Sacado::Promote<scalar_type_1, \
514 scalar_type_2>::type scalar_type; \
516 typedef typename ExprT1::base_expr_type base_expr_type_1; \
517 typedef typename ExprT2::base_expr_type base_expr_type_2; \
518 typedef typename Sacado::Promote<base_expr_type_1, \
519 base_expr_type_2>::type base_expr_type; \
521 SACADO_INLINE_FUNCTION \
522 Expr(const ExprT1& expr1_, const ConstT& c_) : \
523 expr1(expr1_), c(c_) {} \
525 SACADO_INLINE_FUNCTION \
527 return expr1.size(); \
530 SACADO_INLINE_FUNCTION \
531 bool hasFastAccess() const { \
532 return expr1.hasFastAccess(); \
535 SACADO_INLINE_FUNCTION \
536 bool isPassive() const { \
537 return expr1.isPassive(); \
540 SACADO_INLINE_FUNCTION \
541 bool updateValue() const { return expr1.updateValue(); } \
543 SACADO_INLINE_FUNCTION \
544 void cache() const {} \
546 SACADO_INLINE_FUNCTION \
547 const value_type val() const { \
549 return VAL_CONST_DX_2; \
552 SACADO_INLINE_FUNCTION \
553 const value_type dx(int i) const { \
558 SACADO_INLINE_FUNCTION \
559 const value_type fastAccessDx(int i) const { \
561 return CONST_FASTACCESSDX_2; \
566 const ExprT1& expr1; \
570 template <typename T1, typename ExprT2> \
571 struct ExprSpec< OP< ConstExpr<T1>, ExprT2 > > { \
572 typedef typename ExprSpec<ExprT2>::type type; \
575 template <typename T1, typename ExprT2> \
576 class Expr< OP< ConstExpr<T1>, ExprT2 >,ExprSpecDefault > { \
580 typedef ConstExpr<T1> ConstT; \
581 typedef ConstExpr<T1> ExprT1; \
582 typedef typename ExprT1::value_type value_type_1; \
583 typedef typename ExprT2::value_type value_type_2; \
584 typedef typename Sacado::Promote<value_type_1, \
585 value_type_2>::type value_type; \
587 typedef typename ExprT1::scalar_type scalar_type_1; \
588 typedef typename ExprT2::scalar_type scalar_type_2; \
589 typedef typename Sacado::Promote<scalar_type_1, \
590 scalar_type_2>::type scalar_type; \
592 typedef typename ExprT1::base_expr_type base_expr_type_1; \
593 typedef typename ExprT2::base_expr_type base_expr_type_2; \
594 typedef typename Sacado::Promote<base_expr_type_1, \
595 base_expr_type_2>::type base_expr_type; \
598 SACADO_INLINE_FUNCTION \
599 Expr(const ConstT& c_, const ExprT2& expr2_) : \
600 c(c_), expr2(expr2_) {} \
602 SACADO_INLINE_FUNCTION \
604 return expr2.size(); \
607 SACADO_INLINE_FUNCTION \
608 bool hasFastAccess() const { \
609 return expr2.hasFastAccess(); \
612 SACADO_INLINE_FUNCTION \
613 bool isPassive() const { \
614 return expr2.isPassive(); \
617 SACADO_INLINE_FUNCTION \
618 bool updateValue() const { return expr2.updateValue(); } \
620 SACADO_INLINE_FUNCTION \
621 void cache() const {} \
623 SACADO_INLINE_FUNCTION \
624 const value_type val() const { \
626 return VAL_CONST_DX_1; \
629 SACADO_INLINE_FUNCTION \
630 const value_type dx(int i) const { \
635 SACADO_INLINE_FUNCTION \
636 const value_type fastAccessDx(int i) const { \
638 return CONST_FASTACCESSDX_1; \
644 const ExprT2& expr2; \
647 template <typename T1, typename T2> \
648 SACADO_INLINE_FUNCTION \
649 typename mpl::enable_if_c< \
650 ExprLevel< Expr<T1> >::value == ExprLevel< Expr<T2> >::value, \
651 Expr< OP< Expr<T1>, Expr<T2> > > \
654 OPNAME (const Expr<T1>& expr1, const Expr<T2>& expr2) \
656 typedef OP< Expr<T1>, Expr<T2> > expr_t; \
658 return Expr<expr_t>(expr1, expr2); \
661 template <typename T> \
662 SACADO_INLINE_FUNCTION \
663 Expr< OP< Expr<T>, Expr<T> > > \
664 OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
666 typedef OP< Expr<T>, Expr<T> > expr_t; \
668 return Expr<expr_t>(expr1, expr2); \
671 template <typename T> \
672 SACADO_INLINE_FUNCTION \
673 Expr< OP< ConstExpr<typename Expr<T>::value_type>, \
675 OPNAME (const typename Expr<T>::value_type& c, \
676 const Expr<T>& expr) \
678 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
679 typedef OP< ConstT, Expr<T> > expr_t; \
681 return Expr<expr_t>(ConstT(c), expr); \
684 template <typename T> \
685 SACADO_INLINE_FUNCTION \
687 ConstExpr<typename Expr<T>::value_type> > > \
688 OPNAME (const Expr<T>& expr, \
689 const typename Expr<T>::value_type& c) \
691 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
692 typedef OP< Expr<T>, ConstT > expr_t; \
694 return Expr<expr_t>(expr, ConstT(c)); \
697 template <typename T> \
698 SACADO_INLINE_FUNCTION \
699 SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
700 OPNAME (const typename Expr<T>::scalar_type& c, \
701 const Expr<T>& expr) \
703 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
704 typedef OP< ConstT, Expr<T> > expr_t; \
706 return Expr<expr_t>(ConstT(c), expr); \
709 template <typename T> \
710 SACADO_INLINE_FUNCTION \
711 SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
712 OPNAME (const Expr<T>& expr, \
713 const typename Expr<T>::scalar_type& c) \
715 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
716 typedef OP< Expr<T>, ConstT > expr_t; \
718 return Expr<expr_t>(expr, ConstT(c)); \
728 expr1.val() + expr2.val(),
729 expr1.dx(i) + expr2.dx(i),
730 expr1.fastAccessDx(i) + expr2.fastAccessDx(i),
731 c.val() + expr2.val(),
732 expr1.val() +
c.val(),
735 expr2.fastAccessDx(i),
736 expr1.fastAccessDx(i))
740 expr1.val() - expr2.val(),
741 expr1.dx(i) - expr2.dx(i),
742 expr1.fastAccessDx(i) - expr2.fastAccessDx(i),
743 c.val() - expr2.val(),
744 expr1.val() -
c.val(),
747 -expr2.fastAccessDx(i),
748 expr1.fastAccessDx(i))
765 expr1.val() / expr2.val(),
766 (expr1.dx(i)*expr2.val() - expr2.dx(i)*expr1.val()) /
767 (expr2.val()*expr2.val()),
768 (expr1.fastAccessDx(i)*expr2.val() -
769 expr2.fastAccessDx(i)*expr1.val()) /
770 (expr2.val()*expr2.val()),
771 c.val() / expr2.val(),
772 expr1.val() /
c.val(),
773 -expr2.dx(i)*
c.val() / (expr2.val()*expr2.val()),
775 -expr2.fastAccessDx(i)*
c.val() / (expr2.val()*expr2.val()),
776 expr1.fastAccessDx(i)/
c.val())
780 atan2(expr1.val(), expr2.val()),
781 (expr2.val()*expr1.dx(i) - expr1.val()*expr2.dx(i))/
782 (expr1.val()*expr1.val() + expr2.val()*expr2.val()),
783 (expr2.val()*expr1.fastAccessDx(i) - expr1.val()*expr2.fastAccessDx(i))/
784 (expr1.val()*expr1.val() + expr2.val()*expr2.val()),
785 atan2(
c.val(), expr2.val()),
786 atan2(expr1.val(),
c.val()),
787 (-
c.val()*expr2.dx(i)) / (
c.val()*
c.val() + expr2.val()*expr2.val()),
788 (
c.val()*expr1.dx(i))/ (expr1.val()*expr1.val() +
c.val()*
c.val()),
789 (-
c.val()*expr2.fastAccessDx(i))/ (
c.val()*
c.val() + expr2.val()*expr2.val()),
790 (
c.val()*expr1.fastAccessDx(i))/ (expr1.val()*expr1.val() +
c.val()*
c.val()))
805 using Sacado::if_then_else;,
806 if_then_else( expr1.val() >= expr2.val(), expr1.val(), expr2.val() ),
807 if_then_else( expr1.val() >= expr2.val(), expr1.
dx(i), expr2.
dx(i) ),
809 if_then_else(
c.val() >= expr2.val(), value_type(
c.val()), expr2.val() ),
810 if_then_else( expr1.val() >=
c.val(), expr1.val(), value_type(
c.val()) ),
811 if_then_else(
c.val() >= expr2.val(), value_type(0.0), expr2.
dx(i) ),
812 if_then_else( expr1.val() >=
c.val(), expr1.
dx(i), value_type(0.0) ),
813 if_then_else(
c.val() >= expr2.val(), value_type(0.0), expr2.
fastAccessDx(i) ),
814 if_then_else( expr1.val() >=
c.val(), expr1.
fastAccessDx(i), value_type(0.0) ) )
817 using Sacado::if_then_else;,
818 if_then_else( expr1.val() <= expr2.val(), expr1.val(), expr2.val() ),
819 if_then_else( expr1.val() <= expr2.val(), expr1.
dx(i), expr2.
dx(i) ),
821 if_then_else(
c.val() <= expr2.val(), value_type(
c.val()), expr2.val() ),
822 if_then_else( expr1.val() <=
c.val(), expr1.val(), value_type(
c.val()) ),
823 if_then_else(
c.val() <= expr2.val(), value_type(0), expr2.
dx(i) ),
824 if_then_else( expr1.val() <=
c.val(), expr1.
dx(i), value_type(0) ),
825 if_then_else(
c.val() <= expr2.val(), value_type(0), expr2.
fastAccessDx(i) ),
826 if_then_else( expr1.val() <=
c.val(), expr1.
fastAccessDx(i), value_type(0) ) )
829 #undef FAD_BINARYOP_MACRO
834 template <
typename ExprT1,
typename ExprT2>
837 template <
typename ExprT1,
typename ExprT2>
838 struct ExprSpec< MultiplicationOp< ExprT1, ExprT2 > > {
839 typedef typename ExprSpec<ExprT1>::type
type;
842 template <
typename ExprT1,
typename ExprT2>
843 class Expr< MultiplicationOp< ExprT1, ExprT2 >,ExprSpecDefault > {
847 typedef typename ExprT1::value_type value_type_1;
848 typedef typename ExprT2::value_type value_type_2;
852 typedef typename ExprT1::scalar_type scalar_type_1;
853 typedef typename ExprT2::scalar_type scalar_type_2;
855 scalar_type_2>::type scalar_type;
857 typedef typename ExprT1::base_expr_type base_expr_type_1;
858 typedef typename ExprT2::base_expr_type base_expr_type_2;
860 base_expr_type_2>::type base_expr_type;
863 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
864 expr1(expr1_), expr2(expr2_) {}
868 int sz1 = expr1.size(), sz2 = expr2.size();
869 return sz1 > sz2 ? sz1 : sz2;
873 bool hasFastAccess()
const {
874 return expr1.hasFastAccess() && expr2.hasFastAccess();
878 bool isPassive()
const {
879 return expr1.isPassive() && expr2.isPassive();
883 bool updateValue()
const {
884 return expr1.updateValue() && expr2.updateValue();
888 void cache()
const {}
891 const value_type
val()
const {
892 return expr1.val()*expr2.val();
896 const value_type
dx(
int i)
const {
897 if (expr1.size() > 0 && expr2.size() > 0)
898 return expr1.val()*expr2.dx(i) + expr1.dx(i)*expr2.val();
899 else if (expr1.size() > 0)
900 return expr1.dx(i)*expr2.val();
902 return expr1.val()*expr2.dx(i);
907 return expr1.val()*expr2.fastAccessDx(i) +
908 expr1.fastAccessDx(i)*expr2.val();
918 template <
typename ExprT1,
typename T2>
919 struct ExprSpec< MultiplicationOp< ExprT1, ConstExpr<T2> > > {
920 typedef typename ExprSpec<ExprT1>::type
type;
923 template <
typename ExprT1,
typename T2>
924 class Expr< MultiplicationOp< ExprT1, ConstExpr<T2> >,ExprSpecDefault > {
928 typedef ConstExpr<T2> ConstT;
929 typedef ConstExpr<T2> ExprT2;
930 typedef typename ExprT1::value_type value_type_1;
931 typedef typename ExprT2::value_type value_type_2;
935 typedef typename ExprT1::scalar_type scalar_type_1;
936 typedef typename ExprT2::scalar_type scalar_type_2;
938 scalar_type_2>::type scalar_type;
940 typedef typename ExprT1::base_expr_type base_expr_type_1;
941 typedef typename ExprT2::base_expr_type base_expr_type_2;
943 base_expr_type_2>::type base_expr_type;
946 Expr(
const ExprT1& expr1_,
const ConstT&
c_) :
947 expr1(expr1_),
c(c_) {}
955 bool hasFastAccess()
const {
956 return expr1.hasFastAccess();
960 bool isPassive()
const {
961 return expr1.isPassive();
965 bool updateValue()
const {
return expr1.updateValue(); }
968 void cache()
const {}
971 const value_type
val()
const {
972 return expr1.val()*
c.val();
976 const value_type
dx(
int i)
const {
977 return expr1.dx(i)*
c.val();
982 return expr1.fastAccessDx(i)*
c.val();
991 template <
typename T1,
typename ExprT2>
992 struct ExprSpec< MultiplicationOp< ConstExpr<T1>, ExprT2 > > {
993 typedef typename ExprSpec<ExprT2>::type
type;
996 template <
typename T1,
typename ExprT2>
997 class Expr< MultiplicationOp< ConstExpr<T1>, ExprT2 >,ExprSpecDefault > {
1001 typedef ConstExpr<T1> ConstT;
1002 typedef ConstExpr<T1> ExprT1;
1003 typedef typename ExprT1::value_type value_type_1;
1004 typedef typename ExprT2::value_type value_type_2;
1008 typedef typename ExprT1::scalar_type scalar_type_1;
1009 typedef typename ExprT2::scalar_type scalar_type_2;
1011 scalar_type_2>::type scalar_type;
1013 typedef typename ExprT1::base_expr_type base_expr_type_1;
1014 typedef typename ExprT2::base_expr_type base_expr_type_2;
1016 base_expr_type_2>::type base_expr_type;
1019 Expr(
const ConstT&
c_,
const ExprT2& expr2_) :
1020 c(c_), expr2(expr2_) {}
1024 return expr2.size();
1028 bool hasFastAccess()
const {
1029 return expr2.hasFastAccess();
1033 bool isPassive()
const {
1034 return expr2.isPassive();
1038 bool updateValue()
const {
return expr2.updateValue(); }
1041 void cache()
const {}
1044 const value_type
val()
const {
1045 return c.val()*expr2.val();
1049 const value_type
dx(
int i)
const {
1050 return c.val()*expr2.dx(i);
1055 return c.val()*expr2.fastAccessDx(i);
1061 const ExprT2& expr2;
1064 template <
typename T1,
typename T2>
1066 typename mpl::enable_if_c<
1068 Expr< MultiplicationOp< Expr<T1>, Expr<T2> > >
1071 operator* (
const Expr<T1>& expr1,
const Expr<T2>& expr2)
1073 typedef MultiplicationOp< Expr<T1>, Expr<T2> > expr_t;
1075 return Expr<expr_t>(expr1, expr2);
1078 template <
typename T>
1080 Expr< MultiplicationOp< Expr<T>, Expr<T> > >
1081 operator* (
const Expr<T>& expr1,
const Expr<T>& expr2)
1083 typedef MultiplicationOp< Expr<T>, Expr<T> > expr_t;
1085 return Expr<expr_t>(expr1, expr2);
1088 template <
typename T>
1090 Expr< MultiplicationOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
1091 operator* (
const typename Expr<T>::value_type&
c,
1092 const Expr<T>& expr)
1094 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1095 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
1097 return Expr<expr_t>(ConstT(c), expr);
1100 template <
typename T>
1102 Expr< MultiplicationOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
1104 const typename Expr<T>::value_type& c)
1106 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1107 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
1109 return Expr<expr_t>(expr, ConstT(c));
1112 template <
typename T>
1115 operator* (
const typename Expr<T>::scalar_type& c,
1116 const Expr<T>& expr)
1118 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1119 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
1121 return Expr<expr_t>(ConstT(c), expr);
1124 template <
typename T>
1128 const typename Expr<T>::scalar_type& c)
1130 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1131 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
1133 return Expr<expr_t>(expr, ConstT(c));
1145 template <
typename ExprT1,
typename ExprT2,
typename Impl>
1148 template <
typename ExprT1,
typename ExprT2>
1153 template <
typename ExprT1,
typename T2>
1158 template <
typename T1,
typename ExprT2>
1166 template <
typename ExprT1,
typename ExprT2>
1187 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1188 expr1(expr1_), expr2(expr2_) {}
1192 int sz1 = expr1.size(), sz2 = expr2.size();
1193 return sz1 > sz2 ? sz1 : sz2;
1198 return expr1.hasFastAccess() && expr2.hasFastAccess();
1203 return expr1.isPassive() && expr2.isPassive();
1208 return expr1.updateValue() && expr2.updateValue();
1215 const value_type
val()
const {
1217 return pow(expr1.val(), expr2.val());
1221 const value_type
dx(
int i)
const {
1223 const int sz1 = expr1.size(), sz2 = expr2.size();
1224 if (sz1 > 0 && sz2 > 0)
1247 template <
typename ExprT1,
typename T2>
1272 expr1(expr1_),
c(c_) {}
1276 return expr1.size();
1281 return expr1.hasFastAccess();
1286 return expr1.isPassive();
1296 const value_type
val()
const {
1298 return pow(expr1.val(),
c.val());
1302 const value_type
dx(
int i)
const {
1323 template <
typename T1,
typename ExprT2>
1349 c(c_), expr2(expr2_) {}
1353 return expr2.size();
1358 return expr2.hasFastAccess();
1363 return expr2.isPassive();
1373 const value_type
val()
const {
1375 return pow(
c.val(), expr2.val());
1379 const value_type
dx(
int i)
const {
1400 template <
typename ExprT1,
typename ExprT2>
1422 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1423 expr1(expr1_), expr2(expr2_) {}
1427 int sz1 = expr1.size(), sz2 = expr2.size();
1428 return sz1 > sz2 ? sz1 : sz2;
1433 return expr1.hasFastAccess() && expr2.hasFastAccess();
1438 return expr1.isPassive() && expr2.isPassive();
1443 return expr1.updateValue() && expr2.updateValue();
1450 const value_type
val()
const {
1452 return pow(expr1.val(), expr2.val());
1456 const value_type
dx(
int i)
const {
1458 const int sz1 = expr1.size(), sz2 = expr2.size();
1459 if (sz1 > 0 && sz2 > 0)
1472 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()));
1482 template <
typename ExprT1,
typename T2>
1507 expr1(expr1_),
c(c_) {}
1511 return expr1.size();
1516 return expr1.hasFastAccess();
1521 return expr1.isPassive();
1531 const value_type
val()
const {
1533 return pow(expr1.val(),
c.val());
1537 const value_type
dx(
int i)
const {
1558 template <
typename T1,
typename ExprT2>
1584 c(c_), expr2(expr2_) {}
1588 return expr2.size();
1593 return expr2.hasFastAccess();
1598 return expr2.isPassive();
1608 const value_type
val()
const {
1610 return pow(
c.val(), expr2.val());
1614 const value_type
dx(
int i)
const {
1636 template <
typename ExprT1,
typename ExprT2>
1658 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1659 expr1(expr1_), expr2(expr2_) {}
1663 int sz1 = expr1.size(), sz2 = expr2.size();
1664 return sz1 > sz2 ? sz1 : sz2;
1669 return expr1.hasFastAccess() && expr2.hasFastAccess();
1674 return expr1.isPassive() && expr2.isPassive();
1679 return expr1.updateValue() && expr2.updateValue();
1686 const value_type
val()
const {
1688 return pow(expr1.val(), expr2.val());
1692 const value_type
dx(
int i)
const {
1694 const int sz1 = expr1.size(), sz2 = expr2.size();
1695 if (sz1 > 0 && sz2 > 0)
1696 return (expr2.dx(i)*
log(expr1.val())+expr2.val()*expr1.dx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1700 return expr2.dx(i)*
log(expr1.val())*
pow(expr1.val(),expr2.val());
1706 return (expr2.fastAccessDx(i)*
log(expr1.val())+expr2.val()*expr1.fastAccessDx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1716 template <
typename ExprT1,
typename T2>
1741 expr1(expr1_),
c(c_) {}
1745 return expr1.size();
1750 return expr1.hasFastAccess();
1755 return expr1.isPassive();
1765 const value_type
val()
const {
1767 return pow(expr1.val(),
c.val());
1771 const value_type
dx(
int i)
const {
1788 template <
typename T1,
typename ExprT2>
1814 c(c_), expr2(expr2_) {}
1818 return expr2.size();
1823 return expr2.hasFastAccess();
1828 return expr2.isPassive();
1838 const value_type
val()
const {
1840 return pow(
c.val(), expr2.val());
1844 const value_type
dx(
int i)
const {
1846 return expr2.dx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
1852 return expr2.fastAccessDx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
1866 template <
typename ExprT1,
typename ExprT2>
1888 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1889 expr1(expr1_), expr2(expr2_) {}
1893 int sz1 = expr1.size(), sz2 = expr2.size();
1894 return sz1 > sz2 ? sz1 : sz2;
1899 return expr1.hasFastAccess() && expr2.hasFastAccess();
1904 return expr1.isPassive() && expr2.isPassive();
1909 return expr1.updateValue() && expr2.updateValue();
1916 const value_type
val()
const {
1918 return pow(expr1.val(), expr2.val());
1922 const value_type
dx(
int i)
const {
1924 const int sz1 = expr1.size(), sz2 = expr2.size();
1925 if (sz1 > 0 && sz2 > 0)
1926 return (expr2.dx(i)*
log(expr1.val())+expr2.val()*expr1.dx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1930 return expr2.dx(i)*
log(expr1.val())*
pow(expr1.val(),expr2.val());
1936 return (expr2.fastAccessDx(i)*
log(expr1.val())+expr2.val()*expr1.fastAccessDx(i)/expr1.val())*
pow(expr1.val(),expr2.val());
1946 template <
typename ExprT1,
typename T2>
1971 expr1(expr1_),
c(c_) {}
1975 return expr1.size();
1980 return expr1.hasFastAccess();
1985 return expr1.isPassive();
1995 const value_type
val()
const {
1997 return pow(expr1.val(),
c.val());
2001 const value_type
dx(
int i)
const {
2018 template <
typename T1,
typename ExprT2>
2044 c(c_), expr2(expr2_) {}
2048 return expr2.size();
2053 return expr2.hasFastAccess();
2058 return expr2.isPassive();
2068 const value_type
val()
const {
2070 return pow(
c.val(), expr2.val());
2074 const value_type
dx(
int i)
const {
2076 return expr2.dx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
2082 return expr2.fastAccessDx(i)*
log(
c.val())*
pow(
c.val(),expr2.val());
2091 template <
typename T1,
typename T2>
2105 template <
typename T>
2107 Expr< PowerOp< Expr<T>, Expr<T> > >
2115 template <
typename T>
2117 Expr< PowerOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
2127 template <
typename T>
2129 Expr< PowerOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
2139 template <
typename T>
2143 const
Expr<
T>& expr)
2151 template <
typename T>
2155 const typename
Expr<
T>::scalar_type&
c)
2173 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2176 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2181 template <
typename CondT,
typename ExprT1,
typename ExprT2>
2202 Expr(
const CondT& cond_,
const ExprT1& expr1_,
const ExprT2& expr2_) :
2203 cond(cond_), expr1(expr1_), expr2(expr2_) {}
2207 int sz1 = expr1.size(), sz2 = expr2.size();
2208 return sz1 > sz2 ? sz1 : sz2;
2213 return expr1.hasFastAccess() && expr2.hasFastAccess();
2218 return expr1.isPassive() && expr2.isPassive();
2223 return expr1.updateValue() && expr2.updateValue();
2230 const value_type
val()
const {
2236 const value_type
dx(
int i)
const {
2244 return if_then_else( cond, expr1.fastAccessDx(i), expr2.fastAccessDx(i) );
2255 template <
typename CondT,
typename ExprT1,
typename T2>
2260 template <
typename CondT,
typename ExprT1,
typename T2>
2284 cond(cond_), expr1(expr1_),
c(c_) {}
2288 return expr1.size();
2293 return expr1.hasFastAccess();
2298 return expr1.isPassive();
2308 const value_type
val()
const {
2314 const value_type
dx(
int i)
const {
2332 template <
typename CondT,
typename T1,
typename ExprT2>
2337 template <
typename CondT,
typename T1,
typename ExprT2>
2361 cond(cond_),
c(c_), expr2(expr2_) {}
2365 return expr2.size();
2370 return expr2.hasFastAccess();
2375 return expr2.isPassive();
2385 const value_type
val()
const {
2391 const value_type
dx(
int i)
const {
2409 template <
typename CondT,
typename T1,
typename T2>
2422 template <
typename CondT,
typename T>
2424 Expr< IfThenElseOp< CondT, Expr<T>, Expr<T> > >
2432 template <
typename CondT,
typename T>
2434 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::value_type>,
2445 template <
typename CondT,
typename T>
2447 Expr< IfThenElseOp< CondT, Expr<T>,
2448 ConstExpr<typename Expr<T>::value_type> > >
2458 template <
typename CondT,
typename T>
2461 std::is_same< typename Expr<T>::value_type,
2462 typename Expr<T>::scalar_type>,
2463 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::scalar_type>,
2475 template <
typename CondT,
typename T>
2478 std::is_same< typename Expr<T>::value_type,
2479 typename Expr<T>::scalar_type>,
2480 Expr< IfThenElseOp< CondT, Expr<T>,
2481 ConstExpr<typename Expr<T>::scalar_type> > >
2498 template <
typename T1,
typename T2 = T1>
2500 typedef decltype( std::declval<T1>() == std::declval<T2>() )
type;
2505 #define FAD_RELOP_MACRO(OP) \
2506 namespace Sacado { \
2508 template <typename ExprT1, typename ExprT2> \
2509 SACADO_INLINE_FUNCTION \
2510 typename ConditionalReturnType<typename Expr<ExprT1>::value_type, \
2511 typename Expr<ExprT2>::value_type>::type \
2512 operator OP (const Expr<ExprT1>& expr1, \
2513 const Expr<ExprT2>& expr2) \
2515 return expr1.val() OP expr2.val(); \
2518 template <typename ExprT2> \
2519 SACADO_INLINE_FUNCTION \
2520 typename ConditionalReturnType<typename Expr<ExprT2>::value_type>::type \
2521 operator OP (const typename Expr<ExprT2>::value_type& a, \
2522 const Expr<ExprT2>& expr2) \
2524 return a OP expr2.val(); \
2527 template <typename ExprT1> \
2528 SACADO_INLINE_FUNCTION \
2529 typename ConditionalReturnType<typename Expr<ExprT1>::value_type>::type \
2530 operator OP (const Expr<ExprT1>& expr1, \
2531 const typename Expr<ExprT1>::value_type& b) \
2533 return expr1.val() OP b; \
2549 #undef FAD_RELOP_MACRO
2555 template <
typename ExprT>
2559 return ! expr.val();
2571 template <
typename ExprT>
2574 bool is_zero = (x.val() == 0.0);
2575 for (
int i=0; i<x.size(); i++)
2576 is_zero = is_zero && (x.dx(i) == 0.0);
2584 #define FAD_BOOL_MACRO(OP) \
2585 namespace Sacado { \
2587 template <typename ExprT1, typename ExprT2> \
2588 SACADO_INLINE_FUNCTION \
2590 operator OP (const Expr<ExprT1>& expr1, \
2591 const Expr<ExprT2>& expr2) \
2593 return toBool(expr1) OP toBool(expr2); \
2596 template <typename ExprT2> \
2597 SACADO_INLINE_FUNCTION \
2599 operator OP (const typename Expr<ExprT2>::value_type& a, \
2600 const Expr<ExprT2>& expr2) \
2602 return a OP toBool(expr2); \
2605 template <typename ExprT1> \
2606 SACADO_INLINE_FUNCTION \
2608 operator OP (const Expr<ExprT1>& expr1, \
2609 const typename Expr<ExprT1>::value_type& b) \
2611 return toBool(expr1) OP b; \
2619 #undef FAD_BOOL_MACRO
2627 template <
typename ExprT>
2628 std::ostream& operator << (std::ostream& os, const Expr<ExprT>&
x) {
2629 os <<
x.val() <<
" [";
2631 for (
int i=0; i<
x.size(); i++) {
2632 os <<
" " <<
x.dx(i);
2643 #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