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 KOKKOS_INLINE_FUNCTION \
81 Expr(const ExprT& expr_) : expr(expr_) {} \
83 KOKKOS_INLINE_FUNCTION \
84 int size() const { return expr.size(); } \
86 KOKKOS_INLINE_FUNCTION \
87 bool hasFastAccess() const { return expr.hasFastAccess(); } \
89 KOKKOS_INLINE_FUNCTION \
90 bool isPassive() const { return expr.isPassive();} \
92 KOKKOS_INLINE_FUNCTION \
93 bool updateValue() const { return expr.updateValue(); } \
95 KOKKOS_INLINE_FUNCTION \
96 void cache() const {} \
98 KOKKOS_INLINE_FUNCTION \
99 value_type val() const { \
104 KOKKOS_INLINE_FUNCTION \
105 value_type dx(int i) const { \
110 KOKKOS_INLINE_FUNCTION \
111 value_type fastAccessDx(int i) const { \
113 return FASTACCESSDX; \
121 template <typename T> \
122 KOKKOS_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()),
209 expr.
fastAccessDx(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()),
224 using std::tanh; using std::cosh;,
226 expr.
dx(i)/( cosh(expr.val())* cosh(expr.val())),
228 ( cosh(expr.val())* cosh(expr.val())))
231 using std::acosh; using std::sqrt;,
233 expr.
dx(i)/ sqrt((expr.val()-value_type(1)) *
234 (expr.val()+value_type(1))),
236 (expr.val()+value_type(1))))
239 using std::asinh; using std::sqrt;,
241 expr.
dx(i)/ sqrt(value_type(1)+expr.val()*expr.val()),
243 expr.val()*expr.val()))
248 expr.
dx(i)/(value_type(1)-expr.val()*expr.val()),
250 expr.val()*expr.val()))
255 if_then_else( expr.val() >= 0, expr.
dx(i), value_type(-expr.
dx(i)) ),
259 using std::fabs; using Sacado::if_then_else;,
261 if_then_else( expr.val() >= 0, expr.
dx(i), value_type(-expr.
dx(i)) ),
263 #ifdef HAVE_SACADO_CXX11
268 expr.dx(i)/(value_type(3)*
cbrt(expr.val()*expr.val())),
269 expr.fastAccessDx(i)/(value_type(3)*
cbrt(expr.val()*expr.val())))
272 #undef FAD_UNARYOP_MACRO
274 #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) \
278 template <typename ExprT1, typename ExprT2> \
281 template <typename ExprT1, typename ExprT2> \
282 struct ExprSpec< OP< ExprT1, ExprT2 > > { \
283 typedef
typename ExprSpec<ExprT1>::type type; \
286 template <typename ExprT1, typename ExprT2> \
287 class Expr< OP< ExprT1, ExprT2 >,ExprSpecDefault > { \
291 typedef
typename ExprT1::value_type value_type_1; \
292 typedef
typename ExprT2::value_type value_type_2; \
294 value_type_2>::type value_type; \
296 typedef
typename ExprT1::scalar_type scalar_type_1; \
297 typedef
typename ExprT2::scalar_type scalar_type_2; \
299 scalar_type_2>::type scalar_type; \
301 typedef
typename ExprT1::base_expr_type base_expr_type_1; \
302 typedef
typename ExprT2::base_expr_type base_expr_type_2; \
304 base_expr_type_2>::type base_expr_type; \
306 KOKKOS_INLINE_FUNCTION \
307 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) : \
308 expr1(expr1_), expr2(expr2_) {} \
310 KOKKOS_INLINE_FUNCTION \
312 int sz1 = expr1.size(), sz2 = expr2.size(); \
313 return sz1 > sz2 ? sz1 : sz2; \
316 KOKKOS_INLINE_FUNCTION \
317 bool hasFastAccess()
const { \
318 return expr1.hasFastAccess() && expr2.hasFastAccess(); \
321 KOKKOS_INLINE_FUNCTION \
322 bool isPassive()
const { \
323 return expr1.isPassive() && expr2.isPassive(); \
326 KOKKOS_INLINE_FUNCTION \
327 bool updateValue()
const { \
328 return expr1.updateValue() && expr2.updateValue(); \
332 void cache()
const {} \
334 KOKKOS_INLINE_FUNCTION \
335 const value_type
val()
const { \
340 KOKKOS_INLINE_FUNCTION \
341 const value_type
dx(
int i)
const { \
346 KOKKOS_INLINE_FUNCTION \
349 return FASTACCESSDX; \
354 const ExprT1& expr1; \
355 const ExprT2& expr2; \
359 template <typename ExprT1, typename T2> \
360 struct ExprSpec< OP< ExprT1, ConstExpr<T2> > > { \
361 typedef
typename ExprSpec<ExprT1>::type type; \
364 template <typename ExprT1, typename T2> \
365 class Expr< OP< ExprT1, ConstExpr<T2> >,ExprSpecDefault > { \
369 typedef ConstExpr<T2> ConstT; \
370 typedef ConstExpr<T2> ExprT2; \
371 typedef
typename ExprT1::value_type value_type_1; \
372 typedef
typename ExprT2::value_type value_type_2; \
374 value_type_2>::type value_type; \
376 typedef
typename ExprT1::scalar_type scalar_type_1; \
377 typedef
typename ExprT2::scalar_type scalar_type_2; \
379 scalar_type_2>::type scalar_type; \
381 typedef
typename ExprT1::base_expr_type base_expr_type_1; \
382 typedef
typename ExprT2::base_expr_type base_expr_type_2; \
384 base_expr_type_2>::type base_expr_type; \
386 KOKKOS_INLINE_FUNCTION \
387 Expr(
const ExprT1& expr1_,
const ConstT& c_) : \
388 expr1(expr1_),
c(c_) {} \
390 KOKKOS_INLINE_FUNCTION \
392 return expr1.size(); \
395 KOKKOS_INLINE_FUNCTION \
396 bool hasFastAccess()
const { \
397 return expr1.hasFastAccess(); \
400 KOKKOS_INLINE_FUNCTION \
401 bool isPassive()
const { \
402 return expr1.isPassive(); \
405 KOKKOS_INLINE_FUNCTION \
406 bool updateValue()
const {
return expr1.updateValue(); } \
409 void cache()
const {} \
411 KOKKOS_INLINE_FUNCTION \
412 const value_type
val()
const { \
414 return VAL_CONST_DX_2; \
417 KOKKOS_INLINE_FUNCTION \
418 const value_type
dx(
int i)
const { \
423 KOKKOS_INLINE_FUNCTION \
426 return CONST_FASTACCESSDX_2; \
431 const ExprT1& expr1; \
435 template <typename T1, typename ExprT2> \
436 struct ExprSpec< OP< ConstExpr<T1>, ExprT2 > > { \
437 typedef
typename ExprSpec<ExprT2>::type type; \
440 template <typename T1, typename ExprT2> \
441 class Expr< OP< ConstExpr<T1>, ExprT2 >,ExprSpecDefault > { \
445 typedef ConstExpr<T1> ConstT; \
446 typedef ConstExpr<T1> ExprT1; \
447 typedef
typename ExprT1::value_type value_type_1; \
448 typedef
typename ExprT2::value_type value_type_2; \
450 value_type_2>::type value_type; \
452 typedef
typename ExprT1::scalar_type scalar_type_1; \
453 typedef
typename ExprT2::scalar_type scalar_type_2; \
455 scalar_type_2>::type scalar_type; \
457 typedef
typename ExprT1::base_expr_type base_expr_type_1; \
458 typedef
typename ExprT2::base_expr_type base_expr_type_2; \
460 base_expr_type_2>::type base_expr_type; \
463 KOKKOS_INLINE_FUNCTION \
464 Expr(
const ConstT& c_,
const ExprT2& expr2_) :
\
465 c(c_), expr2(expr2_) {} \
467 KOKKOS_INLINE_FUNCTION \
469 return expr2.size(); \
472 KOKKOS_INLINE_FUNCTION \
473 bool hasFastAccess()
const { \
474 return expr2.hasFastAccess(); \
477 KOKKOS_INLINE_FUNCTION \
478 bool isPassive()
const { \
479 return expr2.isPassive(); \
482 KOKKOS_INLINE_FUNCTION \
483 bool updateValue()
const {
return expr2.updateValue(); } \
486 void cache()
const {} \
488 KOKKOS_INLINE_FUNCTION \
489 const value_type
val()
const { \
491 return VAL_CONST_DX_1; \
494 KOKKOS_INLINE_FUNCTION \
495 const value_type
dx(
int i)
const { \
500 KOKKOS_INLINE_FUNCTION \
503 return CONST_FASTACCESSDX_1; \
509 const ExprT2& expr2; \
512 template <typename T1, typename T2> \
513 KOKKOS_INLINE_FUNCTION \
514 typename mpl::enable_if_c< \
515 ExprLevel< Expr<T1> >::value == ExprLevel< Expr<T2> >::value, \
516 Expr< OP< Expr<T1>, Expr<T2> > > \
519 OPNAME (
const Expr<T1>& expr1,
const Expr<T2>& expr2) \
521 typedef OP< Expr<T1>, Expr<T2> > expr_t; \
523 return Expr<expr_t>(expr1, expr2); \
526 template <typename T> \
527 KOKKOS_INLINE_FUNCTION \
528 Expr< OP< Expr<T>, Expr<T> > > \
529 OPNAME (
const Expr<T>& expr1,
const Expr<T>& expr2) \
531 typedef OP< Expr<T>, Expr<T> > expr_t; \
533 return Expr<expr_t>(expr1, expr2); \
536 template <typename T> \
537 KOKKOS_INLINE_FUNCTION \
538 Expr< OP< ConstExpr<typename Expr<T>::value_type>, \
540 OPNAME (
const typename Expr<T>::value_type&
c, \
541 const Expr<T>& expr) \
543 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
544 typedef OP< ConstT, Expr<T> > expr_t; \
546 return Expr<expr_t>(ConstT(c), expr); \
549 template <typename T> \
550 KOKKOS_INLINE_FUNCTION \
552 ConstExpr<typename Expr<T>::value_type> > > \
553 OPNAME (
const Expr<T>& expr, \
554 const typename Expr<T>::value_type& c) \
556 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
557 typedef OP< Expr<T>, ConstT > expr_t; \
559 return Expr<expr_t>(expr, ConstT(c)); \
562 template <typename T>
\
565 OPNAME (
const typename Expr<T>::scalar_type& c, \
566 const Expr<T>& expr) \
568 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
569 typedef OP< ConstT, Expr<T> > expr_t; \
571 return Expr<expr_t>(ConstT(c), expr); \
574 template <typename T>
\
577 OPNAME (
const Expr<T>& expr, \
578 const typename Expr<T>::scalar_type& c) \
580 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
581 typedef OP< Expr<T>, ConstT > expr_t; \
583 return Expr<expr_t>(expr, ConstT(c)); \
593 expr1.val() + expr2.val(),
594 expr1.dx(i) + expr2.dx(i),
595 expr1.fastAccessDx(i) + expr2.fastAccessDx(i),
596 c.val() + expr2.val(),
597 expr1.val() +
c.val(),
600 expr2.fastAccessDx(i),
601 expr1.fastAccessDx(i))
605 expr1.val() - expr2.val(),
606 expr1.dx(i) - expr2.dx(i),
607 expr1.fastAccessDx(i) - expr2.fastAccessDx(i),
608 c.val() - expr2.val(),
609 expr1.val() -
c.val(),
612 -expr2.fastAccessDx(i),
613 expr1.fastAccessDx(i))
630 expr1.val() / expr2.val(),
631 (expr1.dx(i)*expr2.val() - expr2.dx(i)*expr1.val()) /
632 (expr2.val()*expr2.val()),
633 (expr1.fastAccessDx(i)*expr2.val() -
634 expr2.fastAccessDx(i)*expr1.val()) /
635 (expr2.val()*expr2.val()),
636 c.val() / expr2.val(),
637 expr1.val() /
c.val(),
638 -expr2.dx(i)*
c.val() / (expr2.val()*expr2.val()),
640 -expr2.fastAccessDx(i)*
c.val() / (expr2.val()*expr2.val()),
641 expr1.fastAccessDx(i)/
c.val())
645 atan2(expr1.val(), expr2.val()),
646 (expr2.val()*expr1.dx(i) - expr1.val()*expr2.dx(i))/
647 (expr1.val()*expr1.val() + expr2.val()*expr2.val()),
648 (expr2.val()*expr1.fastAccessDx(i) - expr1.val()*expr2.fastAccessDx(i))/
649 (expr1.val()*expr1.val() + expr2.val()*expr2.val()),
650 atan2(
c.val(), expr2.val()),
651 atan2(expr1.val(),
c.val()),
652 (-
c.val()*expr2.dx(i)) / (
c.val()*
c.val() + expr2.val()*expr2.val()),
653 (
c.val()*expr1.dx(i))/ (expr1.val()*expr1.val() +
c.val()*
c.val()),
654 (-
c.val()*expr2.fastAccessDx(i))/ (
c.val()*
c.val() + expr2.val()*expr2.val()),
655 (
c.val()*expr1.fastAccessDx(i))/ (expr1.val()*expr1.val() +
c.val()*
c.val()))
670 using Sacado::if_then_else;,
671 if_then_else( expr1.val() >= expr2.val(), expr1.val(), expr2.val() ),
672 if_then_else( expr1.val() >= expr2.val(), expr1.
dx(i), expr2.
dx(i) ),
674 if_then_else(
c.val() >= expr2.val(), value_type(
c.val()), expr2.val() ),
675 if_then_else( expr1.val() >=
c.val(), expr1.val(), value_type(
c.val()) ),
676 if_then_else(
c.val() >= expr2.val(), value_type(0.0), expr2.
dx(i) ),
677 if_then_else( expr1.val() >=
c.val(), expr1.
dx(i), value_type(0.0) ),
678 if_then_else(
c.val() >= expr2.val(), value_type(0.0), expr2.
fastAccessDx(i) ),
679 if_then_else( expr1.val() >=
c.val(), expr1.
fastAccessDx(i), value_type(0.0) ) )
682 using Sacado::if_then_else;,
683 if_then_else( expr1.val() <= expr2.val(), expr1.val(), expr2.val() ),
684 if_then_else( expr1.val() <= expr2.val(), expr1.
dx(i), expr2.
dx(i) ),
686 if_then_else(
c.val() <= expr2.val(), value_type(
c.val()), expr2.val() ),
687 if_then_else( expr1.val() <=
c.val(), expr1.val(), value_type(
c.val()) ),
688 if_then_else(
c.val() <= expr2.val(), value_type(0), expr2.
dx(i) ),
689 if_then_else( expr1.val() <=
c.val(), expr1.
dx(i), value_type(0) ),
690 if_then_else(
c.val() <= expr2.val(), value_type(0), expr2.
fastAccessDx(i) ),
691 if_then_else( expr1.val() <=
c.val(), expr1.
fastAccessDx(i), value_type(0) ) )
694 #undef FAD_BINARYOP_MACRO
699 template <
typename ExprT1,
typename ExprT2>
702 template <
typename ExprT1,
typename ExprT2>
703 struct ExprSpec< MultiplicationOp< ExprT1, ExprT2 > > {
704 typedef typename ExprSpec<ExprT1>::type
type;
707 template <
typename ExprT1,
typename ExprT2>
708 class Expr< MultiplicationOp< ExprT1, ExprT2 >,ExprSpecDefault > {
712 typedef typename ExprT1::value_type value_type_1;
713 typedef typename ExprT2::value_type value_type_2;
717 typedef typename ExprT1::scalar_type scalar_type_1;
718 typedef typename ExprT2::scalar_type scalar_type_2;
720 scalar_type_2>::type scalar_type;
722 typedef typename ExprT1::base_expr_type base_expr_type_1;
723 typedef typename ExprT2::base_expr_type base_expr_type_2;
725 base_expr_type_2>::type base_expr_type;
728 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
729 expr1(expr1_), expr2(expr2_) {}
733 int sz1 = expr1.size(), sz2 = expr2.size();
734 return sz1 > sz2 ? sz1 : sz2;
738 bool hasFastAccess()
const {
739 return expr1.hasFastAccess() && expr2.hasFastAccess();
743 bool isPassive()
const {
744 return expr1.isPassive() && expr2.isPassive();
748 bool updateValue()
const {
749 return expr1.updateValue() && expr2.updateValue();
753 void cache()
const {}
756 const value_type
val()
const {
757 return expr1.val()*expr2.val();
761 const value_type
dx(
int i)
const {
762 if (expr1.size() > 0 && expr2.size() > 0)
763 return expr1.val()*expr2.dx(i) + expr1.dx(i)*expr2.val();
764 else if (expr1.size() > 0)
765 return expr1.dx(i)*expr2.val();
767 return expr1.val()*expr2.dx(i);
772 return expr1.val()*expr2.fastAccessDx(i) +
773 expr1.fastAccessDx(i)*expr2.val();
783 template <
typename ExprT1,
typename T2>
784 struct ExprSpec< MultiplicationOp< ExprT1, ConstExpr<T2> > > {
785 typedef typename ExprSpec<ExprT1>::type
type;
788 template <
typename ExprT1,
typename T2>
789 class Expr< MultiplicationOp< ExprT1, ConstExpr<T2> >,ExprSpecDefault > {
793 typedef ConstExpr<T2> ConstT;
794 typedef ConstExpr<T2> ExprT2;
795 typedef typename ExprT1::value_type value_type_1;
796 typedef typename ExprT2::value_type value_type_2;
800 typedef typename ExprT1::scalar_type scalar_type_1;
801 typedef typename ExprT2::scalar_type scalar_type_2;
803 scalar_type_2>::type scalar_type;
805 typedef typename ExprT1::base_expr_type base_expr_type_1;
806 typedef typename ExprT2::base_expr_type base_expr_type_2;
808 base_expr_type_2>::type base_expr_type;
811 Expr(
const ExprT1& expr1_,
const ConstT& c_) :
812 expr1(expr1_),
c(c_) {}
820 bool hasFastAccess()
const {
821 return expr1.hasFastAccess();
825 bool isPassive()
const {
826 return expr1.isPassive();
830 bool updateValue()
const {
return expr1.updateValue(); }
833 void cache()
const {}
836 const value_type
val()
const {
837 return expr1.val()*
c.val();
841 const value_type
dx(
int i)
const {
842 return expr1.dx(i)*
c.val();
847 return expr1.fastAccessDx(i)*
c.val();
856 template <
typename T1,
typename ExprT2>
857 struct ExprSpec< MultiplicationOp< ConstExpr<T1>, ExprT2 > > {
858 typedef typename ExprSpec<ExprT2>::type
type;
861 template <
typename T1,
typename ExprT2>
862 class Expr< MultiplicationOp< ConstExpr<T1>, ExprT2 >,ExprSpecDefault > {
866 typedef ConstExpr<T1> ConstT;
867 typedef ConstExpr<T1> ExprT1;
868 typedef typename ExprT1::value_type value_type_1;
869 typedef typename ExprT2::value_type value_type_2;
873 typedef typename ExprT1::scalar_type scalar_type_1;
874 typedef typename ExprT2::scalar_type scalar_type_2;
876 scalar_type_2>::type scalar_type;
878 typedef typename ExprT1::base_expr_type base_expr_type_1;
879 typedef typename ExprT2::base_expr_type base_expr_type_2;
881 base_expr_type_2>::type base_expr_type;
884 Expr(
const ConstT& c_,
const ExprT2& expr2_) :
885 c(c_), expr2(expr2_) {}
893 bool hasFastAccess()
const {
894 return expr2.hasFastAccess();
898 bool isPassive()
const {
899 return expr2.isPassive();
903 bool updateValue()
const {
return expr2.updateValue(); }
906 void cache()
const {}
909 const value_type
val()
const {
910 return c.val()*expr2.val();
914 const value_type
dx(
int i)
const {
915 return c.val()*expr2.dx(i);
920 return c.val()*expr2.fastAccessDx(i);
929 template <
typename T1,
typename T2>
931 typename mpl::enable_if_c<
932 ExprLevel< Expr<T1> >::value == ExprLevel< Expr<T2> >::value,
933 Expr< MultiplicationOp< Expr<T1>, Expr<T2> > >
936 operator* (
const Expr<T1>& expr1,
const Expr<T2>& expr2)
938 typedef MultiplicationOp< Expr<T1>, Expr<T2> > expr_t;
940 return Expr<expr_t>(expr1, expr2);
943 template <
typename T>
945 Expr< MultiplicationOp< Expr<T>, Expr<T> > >
946 operator* (
const Expr<T>& expr1,
const Expr<T>& expr2)
948 typedef MultiplicationOp< Expr<T>, Expr<T> > expr_t;
950 return Expr<expr_t>(expr1, expr2);
953 template <
typename T>
955 Expr< MultiplicationOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
956 operator* (
const typename Expr<T>::value_type&
c,
959 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
960 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
962 return Expr<expr_t>(ConstT(c), expr);
965 template <
typename T>
967 Expr< MultiplicationOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
969 const typename Expr<T>::value_type& c)
971 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
972 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
974 return Expr<expr_t>(expr, ConstT(c));
977 template <
typename T>
980 operator* (
const typename Expr<T>::scalar_type& c,
983 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
984 typedef MultiplicationOp< ConstT, Expr<T> > expr_t;
986 return Expr<expr_t>(ConstT(c), expr);
989 template <
typename T>
993 const typename Expr<T>::scalar_type& c)
995 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
996 typedef MultiplicationOp< Expr<T>, ConstT > expr_t;
998 return Expr<expr_t>(expr, ConstT(c));
1010 template <
typename ExprT1,
typename ExprT2,
bool is_simd>
1013 template <
typename ExprT1,
typename ExprT2>
1018 template <
typename ExprT1,
typename T2>
1023 template <
typename T1,
typename ExprT2>
1031 template <
typename ExprT1,
typename ExprT2>
1052 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1053 expr1(expr1_), expr2(expr2_) {}
1057 int sz1 = expr1.size(), sz2 = expr2.size();
1058 return sz1 > sz2 ? sz1 : sz2;
1063 return expr1.hasFastAccess() && expr2.hasFastAccess();
1068 return expr1.isPassive() && expr2.isPassive();
1073 return expr1.updateValue() && expr2.updateValue();
1080 const value_type
val()
const {
1082 return pow(expr1.val(), expr2.val());
1086 const value_type
dx(
int i)
const {
1104 template <
typename ExprT1,
typename T2>
1128 expr1(expr1_),
c(c_) {}
1132 return expr1.size();
1137 return expr1.hasFastAccess();
1142 return expr1.isPassive();
1152 const value_type
val()
const {
1154 return pow(expr1.val(),
c.val());
1158 const value_type
dx(
int i)
const {
1179 template <
typename T1,
typename ExprT2>
1204 c(c_), expr2(expr2_) {}
1208 return expr2.size();
1213 return expr2.hasFastAccess();
1218 return expr2.isPassive();
1228 const value_type
val()
const {
1230 return pow(
c.val(), expr2.val());
1234 const value_type
dx(
int i)
const {
1255 template <
typename ExprT1,
typename ExprT2>
1276 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1277 expr1(expr1_), expr2(expr2_) {}
1281 int sz1 = expr1.size(), sz2 = expr2.size();
1282 return sz1 > sz2 ? sz1 : sz2;
1287 return expr1.hasFastAccess() && expr2.hasFastAccess();
1292 return expr1.isPassive() && expr2.isPassive();
1297 return expr1.updateValue() && expr2.updateValue();
1304 const value_type
val()
const {
1306 return pow(expr1.val(), expr2.val());
1310 const value_type
dx(
int i)
const {
1318 return expr1.val() ==
value_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()));
1328 template <
typename ExprT1,
typename T2>
1352 expr1(expr1_),
c(c_) {}
1356 return expr1.size();
1361 return expr1.hasFastAccess();
1366 return expr1.isPassive();
1376 const value_type
val()
const {
1378 return pow(expr1.val(),
c.val());
1382 const value_type
dx(
int i)
const {
1403 template <
typename T1,
typename ExprT2>
1428 c(c_), expr2(expr2_) {}
1432 return expr2.size();
1437 return expr2.hasFastAccess();
1442 return expr2.isPassive();
1452 const value_type
val()
const {
1454 return pow(
c.val(), expr2.val());
1458 const value_type
dx(
int i)
const {
1475 template <
typename T1,
typename T2>
1489 template <
typename T>
1491 Expr< PowerOp< Expr<T>, Expr<T> > >
1499 template <
typename T>
1501 Expr< PowerOp< ConstExpr<typename Expr<T>::value_type>, Expr<T> > >
1511 template <
typename T>
1513 Expr< PowerOp< Expr<T>, ConstExpr<typename Expr<T>::value_type> > >
1523 template <
typename T>
1527 const
Expr<
T>& expr)
1535 template <
typename T>
1539 const typename
Expr<
T>::scalar_type&
c)
1553 #ifdef HAVE_SACADO_CXX11
1558 template <
typename CondT,
typename ExprT1,
typename ExprT2>
1559 class IfThenElseOp {};
1561 template <
typename CondT,
typename ExprT1,
typename ExprT2>
1562 struct ExprSpec< IfThenElseOp< CondT, ExprT1, ExprT2 > > {
1563 typedef typename ExprSpec<ExprT1>::type
type;
1566 template <
typename CondT,
typename ExprT1,
typename ExprT2>
1567 class Expr< IfThenElseOp< CondT, ExprT1, ExprT2 >,ExprSpecDefault > {
1571 typedef typename ExprT1::value_type value_type_1;
1572 typedef typename ExprT2::value_type value_type_2;
1576 typedef typename ExprT1::scalar_type scalar_type_1;
1577 typedef typename ExprT2::scalar_type scalar_type_2;
1579 scalar_type_2>::type scalar_type;
1581 typedef typename ExprT1::base_expr_type base_expr_type_1;
1582 typedef typename ExprT2::base_expr_type base_expr_type_2;
1584 base_expr_type_2>::type base_expr_type;
1587 Expr(
const CondT& cond_,
const ExprT1& expr1_,
const ExprT2& expr2_) :
1588 cond(cond_), expr1(expr1_), expr2(expr2_) {}
1592 int sz1 = expr1.size(), sz2 = expr2.size();
1593 return sz1 > sz2 ? sz1 : sz2;
1597 bool hasFastAccess()
const {
1598 return expr1.hasFastAccess() && expr2.hasFastAccess();
1602 bool isPassive()
const {
1603 return expr1.isPassive() && expr2.isPassive();
1607 bool updateValue()
const {
1608 return expr1.updateValue() && expr2.updateValue();
1612 void cache()
const {}
1615 const value_type
val()
const {
1621 const value_type
dx(
int i)
const {
1629 return if_then_else( cond, expr1.fastAccessDx(i), expr2.fastAccessDx(i) );
1635 const ExprT1& expr1;
1636 const ExprT2& expr2;
1640 template <
typename CondT,
typename ExprT1,
typename T2>
1641 struct ExprSpec< IfThenElseOp< CondT, ExprT1, ConstExpr<
T2> > > {
1642 typedef typename ExprSpec<ExprT1>::type
type;
1645 template <
typename CondT,
typename ExprT1,
typename T2>
1646 class Expr< IfThenElseOp< CondT, ExprT1, ConstExpr<
T2> >,ExprSpecDefault > {
1650 typedef ConstExpr<T2> ConstT;
1651 typedef ConstExpr<T2> ExprT2;
1652 typedef typename ExprT1::value_type value_type_1;
1653 typedef typename ExprT2::value_type value_type_2;
1657 typedef typename ExprT1::scalar_type scalar_type_1;
1658 typedef typename ExprT2::scalar_type scalar_type_2;
1660 scalar_type_2>::type scalar_type;
1662 typedef typename ExprT1::base_expr_type base_expr_type_1;
1663 typedef typename ExprT2::base_expr_type base_expr_type_2;
1665 base_expr_type_2>::type base_expr_type;
1668 Expr(
const CondT& cond_,
const ExprT1& expr1_,
const ConstT& c_) :
1669 cond(cond_), expr1(expr1_),
c(c_) {}
1673 return expr1.size();
1677 bool hasFastAccess()
const {
1678 return expr1.hasFastAccess();
1682 bool isPassive()
const {
1683 return expr1.isPassive();
1687 bool updateValue()
const {
return expr1.updateValue(); }
1690 void cache()
const {}
1693 const value_type
val()
const {
1699 const value_type
dx(
int i)
const {
1713 const ExprT1& expr1;
1717 template <
typename CondT,
typename T1,
typename ExprT2>
1718 struct ExprSpec< IfThenElseOp< CondT, ConstExpr<
T1>, ExprT2 > > {
1719 typedef typename ExprSpec<ExprT2>::type
type;
1722 template <
typename CondT,
typename T1,
typename ExprT2>
1723 class Expr< IfThenElseOp< CondT, ConstExpr<
T1>, ExprT2 >,ExprSpecDefault > {
1727 typedef ConstExpr<T1> ConstT;
1728 typedef ConstExpr<T1> ExprT1;
1729 typedef typename ExprT1::value_type value_type_1;
1730 typedef typename ExprT2::value_type value_type_2;
1734 typedef typename ExprT1::scalar_type scalar_type_1;
1735 typedef typename ExprT2::scalar_type scalar_type_2;
1737 scalar_type_2>::type scalar_type;
1739 typedef typename ExprT1::base_expr_type base_expr_type_1;
1740 typedef typename ExprT2::base_expr_type base_expr_type_2;
1742 base_expr_type_2>::type base_expr_type;
1745 Expr(
const CondT& cond_,
const ConstT& c_,
const ExprT2& expr2_) :
1746 cond(cond_),
c(c_), expr2(expr2_) {}
1750 return expr2.size();
1754 bool hasFastAccess()
const {
1755 return expr2.hasFastAccess();
1759 bool isPassive()
const {
1760 return expr2.isPassive();
1764 bool updateValue()
const {
return expr2.updateValue(); }
1767 void cache()
const {}
1770 const value_type
val()
const {
1776 const value_type
dx(
int i)
const {
1791 const ExprT2& expr2;
1794 template <
typename CondT,
typename T1,
typename T2>
1796 typename mpl::enable_if_c< IsFadExpr<T1>::value && IsFadExpr<T2>::value &&
1797 ExprLevel<T1>::value == ExprLevel<T2>::value,
1798 Expr< IfThenElseOp< CondT, T1, T2 > >
1802 typedef IfThenElseOp< CondT, T1, T2 > expr_t;
1804 return Expr<expr_t>(cond, expr1, expr2);
1807 template <
typename CondT,
typename T>
1809 Expr< IfThenElseOp< CondT, Expr<T>, Expr<T> > >
1810 if_then_else (
const CondT& cond,
const Expr<T>& expr1,
const Expr<T>& expr2)
1812 typedef IfThenElseOp< CondT, Expr<T>, Expr<T> > expr_t;
1814 return Expr<expr_t>(cond, expr1, expr2);
1817 template <
typename CondT,
typename T>
1819 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::value_type>,
1821 if_then_else (
const CondT& cond,
const typename Expr<T>::value_type&
c,
1822 const Expr<T>& expr)
1824 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1825 typedef IfThenElseOp< CondT, ConstT, Expr<T> > expr_t;
1827 return Expr<expr_t>(cond, ConstT(c), expr);
1830 template <
typename CondT,
typename T>
1832 Expr< IfThenElseOp< CondT, Expr<T>,
1833 ConstExpr<typename Expr<T>::value_type> > >
1835 const typename Expr<T>::value_type&
c)
1837 typedef ConstExpr<typename Expr<T>::value_type> ConstT;
1838 typedef IfThenElseOp< CondT, Expr<T>, ConstT > expr_t;
1840 return Expr<expr_t>(cond, expr, ConstT(c));
1843 template <
typename CondT,
typename T>
1845 typename mpl::disable_if<
1846 mpl::is_same< typename Expr<T>::value_type,
1847 typename Expr<T>::scalar_type>,
1848 Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::scalar_type>,
1851 if_then_else (
const CondT& cond,
const typename Expr<T>::scalar_type&
c,
1852 const Expr<T>& expr)
1854 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1855 typedef IfThenElseOp< CondT, ConstT, Expr<T> > expr_t;
1857 return Expr<expr_t>(cond, ConstT(c), expr);
1860 template <
typename CondT,
typename T>
1862 typename mpl::disable_if<
1863 mpl::is_same< typename Expr<T>::value_type,
1864 typename Expr<T>::scalar_type>,
1865 Expr< IfThenElseOp< CondT, Expr<T>,
1866 ConstExpr<typename Expr<T>::scalar_type> > >
1869 const typename Expr<T>::scalar_type&
c)
1871 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT;
1872 typedef IfThenElseOp< CondT, Expr<T>, ConstT > expr_t;
1874 return Expr<expr_t>(cond, expr, ConstT(c));
1883 #ifdef HAVE_SACADO_CXX11
1887 template <
typename T1,
typename T2 = T1>
1888 struct ConditionalReturnType {
1889 typedef decltype( std::declval<T1>() == std::declval<T2>() ) type;
1894 #define FAD_RELOP_MACRO(OP) \
1895 namespace Sacado { \
1897 template <typename ExprT1, typename ExprT2> \
1898 KOKKOS_INLINE_FUNCTION \
1899 typename ConditionalReturnType<typename Expr<ExprT1>::value_type, \
1900 typename Expr<ExprT2>::value_type>::type \
1901 operator OP (const Expr<ExprT1>& expr1, \
1902 const Expr<ExprT2>& expr2) \
1904 return expr1.val() OP expr2.val(); \
1907 template <typename ExprT2> \
1908 KOKKOS_INLINE_FUNCTION \
1909 typename ConditionalReturnType<typename Expr<ExprT2>::value_type>::type \
1910 operator OP (const typename Expr<ExprT2>::value_type& a, \
1911 const Expr<ExprT2>& expr2) \
1913 return a OP expr2.val(); \
1916 template <typename ExprT1> \
1917 KOKKOS_INLINE_FUNCTION \
1918 typename ConditionalReturnType<typename Expr<ExprT1>::value_type>::type \
1919 operator OP (const Expr<ExprT1>& expr1, \
1920 const typename Expr<ExprT1>::value_type& b) \
1922 return expr1.val() OP b; \
1929 #define FAD_RELOP_MACRO(OP) \
1930 namespace Sacado { \
1932 template <typename ExprT1, typename ExprT2> \
1933 KOKKOS_INLINE_FUNCTION \
1935 operator OP (const Expr<ExprT1>& expr1, \
1936 const Expr<ExprT2>& expr2) \
1938 return expr1.val() OP expr2.val(); \
1941 template <typename ExprT2> \
1942 KOKKOS_INLINE_FUNCTION \
1944 operator OP (const typename Expr<ExprT2>::value_type& a, \
1945 const Expr<ExprT2>& expr2) \
1947 return a OP expr2.val(); \
1950 template <typename ExprT1> \
1951 KOKKOS_INLINE_FUNCTION \
1953 operator OP (const Expr<ExprT1>& expr1, \
1954 const typename Expr<ExprT1>::value_type& b) \
1956 return expr1.val() OP b; \
1974 #undef FAD_RELOP_MACRO
1980 template <
typename ExprT>
1984 return ! expr.val();
1996 template <
typename ExprT>
1999 bool is_zero = (x.val() == 0.0);
2000 for (
int i=0; i<x.size(); i++)
2001 is_zero = is_zero && (x.dx(i) == 0.0);
2009 #define FAD_BOOL_MACRO(OP) \
2010 namespace Sacado { \
2012 template <typename ExprT1, typename ExprT2> \
2013 KOKKOS_INLINE_FUNCTION \
2015 operator OP (const Expr<ExprT1>& expr1, \
2016 const Expr<ExprT2>& expr2) \
2018 return toBool(expr1) OP toBool(expr2); \
2021 template <typename ExprT2> \
2022 KOKKOS_INLINE_FUNCTION \
2024 operator OP (const typename Expr<ExprT2>::value_type& a, \
2025 const Expr<ExprT2>& expr2) \
2027 return a OP toBool(expr2); \
2030 template <typename ExprT1> \
2031 KOKKOS_INLINE_FUNCTION \
2033 operator OP (const Expr<ExprT1>& expr1, \
2034 const typename Expr<ExprT1>::value_type& b) \
2036 return toBool(expr1) OP b; \
2044 #undef FAD_BOOL_MACRO
2052 template <
typename ExprT>
2053 std::ostream& operator << (std::ostream& os, const Expr<ExprT>& x) {
2054 os << x.val() <<
" [";
2056 for (
int i=0; i< x.size(); i++) {
2057 os <<
" " << x.dx(i);
2068 #endif // SACADO_FAD_OPS_HPP
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT1::scalar_type scalar_type_1
Wrapper for a generic expression template.
KOKKOS_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT1::scalar_type scalar_type_1
KOKKOS_INLINE_FUNCTION bool isPassive() const
KOKKOS_INLINE_FUNCTION bool updateValue() const
ScalarType< value_type >::type scalar_type
Typename of scalar's (which may be different from ConstT)
Constant expression template.
ExprT1::base_expr_type base_expr_type_1
KOKKOS_INLINE_FUNCTION bool updateValue() const
ExprT1::base_expr_type base_expr_type_1
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
expr expr expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 MultiplicationOp
#define FAD_UNARYOP_MACRO(OPNAME, OP, USING, VALUE, DX, FASTACCESSDX)
KOKKOS_INLINE_FUNCTION const value_type val() const
#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)
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
Sacado::Promote< value_type_1, value_type_2 >::type value_type
KOKKOS_INLINE_FUNCTION bool updateValue() const
ExprT1::base_expr_type base_expr_type_1
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MinOp
KOKKOS_INLINE_FUNCTION void cache() const
ExprT2::scalar_type scalar_type_2
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
KOKKOS_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
expr expr expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 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
KOKKOS_INLINE_FUNCTION bool operator!(const Expr< ExprT > &expr)
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT1::base_expr_type base_expr_type_1
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
ExprT1::value_type value_type_1
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
ExprT2::value_type value_type_2
#define SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP)
KOKKOS_INLINE_FUNCTION bool updateValue() const
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
KOKKOS_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION bool updateValue() const
ExprT2::value_type value_type_2
KOKKOS_INLINE_FUNCTION void cache() const
KOKKOS_INLINE_FUNCTION const value_type val() const
ExprT2::scalar_type scalar_type_2
expr expr expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 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
ExprSpec< ExprT1 >::type type
KOKKOS_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)
SimpleFad< ValueT > log(const SimpleFad< ValueT > &a)
ExprT1::scalar_type scalar_type_1
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
ExprT2::value_type value_type_2
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
#define KOKKOS_INLINE_FUNCTION
Sacado::Promote< value_type_1, value_type_2 >::type value_type
ExprT2::value_type value_type_2
KOKKOS_INLINE_FUNCTION Expr(const ConstT &c_, const ExprT2 &expr2_)
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT2::scalar_type scalar_type_2
KOKKOS_INLINE_FUNCTION int size() const
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 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
#define FAD_BOOL_MACRO(OP)
KOKKOS_INLINE_FUNCTION const value_type val() const
ExprT2::base_expr_type base_expr_type_2
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
KOKKOS_INLINE_FUNCTION bool isPassive() const
SimpleFad< ValueT > min(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT1::scalar_type scalar_type_1
ExprSpec< ExprT2 >::type type
KOKKOS_INLINE_FUNCTION bool isPassive() const
ExprT2::scalar_type scalar_type_2
KOKKOS_INLINE_FUNCTION const value_type val() const
T2 base_expr_type
Typename of base-expressions.
ExprT1::base_expr_type base_expr_type_1
KOKKOS_INLINE_FUNCTION const value_type val() const
atan2(expr1.val(), expr2.val())
Meta-function for determining nesting with an expression.
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
ExprT1::value_type value_type_1
KOKKOS_INLINE_FUNCTION void cache() const
ExprT2::base_expr_type base_expr_type_2
KOKKOS_INLINE_FUNCTION void cache() const
KOKKOS_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ExprT2 &expr2_)
ExprT1::base_expr_type base_expr_type_1
ExprT1::value_type value_type_1
KOKKOS_INLINE_FUNCTION void cache() const
ExprT2::value_type value_type_2
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
ExprT2::base_expr_type base_expr_type_2
KOKKOS_INLINE_FUNCTION Expr(const ExprT1 &expr1_, const ConstT &c_)
KOKKOS_INLINE_FUNCTION bool isPassive() const
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
#define SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP)
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
ExprSpec< ExprT1 >::type type
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::value_type value_type_1
ExprT1::value_type value_type_1
SimpleFad< ValueT > operator*(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
KOKKOS_INLINE_FUNCTION int size() 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)
T2 value_type
Typename of argument values.
Sacado::Promote< value_type_1, value_type_2 >::type value_type
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION void cache() const
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
#define FAD_RELOP_MACRO(OP)
ExprT1::scalar_type scalar_type_1
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
KOKKOS_INLINE_FUNCTION bool toBool(const Expr< ExprT > &x)
KOKKOS_INLINE_FUNCTION T if_then_else(const Cond cond, const T &a, const T &b)
ExprT2::base_expr_type base_expr_type_2
KOKKOS_INLINE_FUNCTION bool isPassive() const
ExprT2::base_expr_type base_expr_type_2
Sacado::Promote< value_type_1, value_type_2 >::type value_type
expr expr expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 SubtractionOp
ExprT2::scalar_type scalar_type_2
KOKKOS_INLINE_FUNCTION bool updateValue() const
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
Sacado::Promote< base_expr_type_1, base_expr_type_2 >::type base_expr_type
ExprT1::value_type value_type_1
KOKKOS_INLINE_FUNCTION bool isPassive() const
ExprT2::value_type value_type_2
ExprT2::base_expr_type base_expr_type_2
ExprT1::scalar_type scalar_type_1
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
KOKKOS_INLINE_FUNCTION const value_type val() const
Sacado::Promote< value_type_1, value_type_2 >::type value_type