52 #ifndef SACADO_CACHEFAD_OPS_HPP
53 #define SACADO_CACHEFAD_OPS_HPP
67 template <
typename ExprT>
70 template <
typename ExprT>
79 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
82 int size()
const {
return expr.size(); }
99 return expr.isLinear();
104 return expr.hasFastAccess();
114 return expr.fastAccessDx(i);
122 template <
typename T>
135 template <
typename ExprT>
138 template <
typename ExprT>
147 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
150 int size()
const {
return expr.size(); }
167 return expr.isLinear();
172 return expr.hasFastAccess();
182 return -expr.fastAccessDx(i);
190 template <
typename T>
204 template <
typename ExprT>
207 template <
typename ExprT>
216 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
219 int size()
const {
return expr.size(); }
243 return expr.hasFastAccess();
248 return v_pos ? expr.dx(i) :
value_type(-expr.dx(i));
253 return v_pos ? expr.fastAccessDx(i) :
value_type(-expr.fastAccessDx(i));
263 template <
typename T>
277 template <
typename ExprT>
280 template <
typename ExprT>
289 explicit Expr(
const ExprT& expr_) : expr(expr_) {}
292 int size()
const {
return expr.size(); }
316 return expr.hasFastAccess();
321 return v_pos ? expr.dx(i) :
value_type(-expr.dx(i));
326 return v_pos ? expr.fastAccessDx(i) :
value_type(-expr.fastAccessDx(i));
336 template <
typename T>
349 #define FAD_UNARYOP_MACRO(OPNAME,OP,PARTIAL,VALUE) \
351 namespace CacheFad { \
353 template <typename ExprT> \
356 template <typename ExprT> \
357 class Expr< OP<ExprT> > { \
360 typedef typename ExprT::value_type value_type; \
361 typedef typename ExprT::scalar_type scalar_type; \
362 typedef typename ExprT::base_expr_type base_expr_type; \
364 KOKKOS_INLINE_FUNCTION \
365 explicit Expr(const ExprT& expr_) : expr(expr_) {} \
367 KOKKOS_INLINE_FUNCTION \
368 int size() const { return expr.size(); } \
370 KOKKOS_INLINE_FUNCTION \
371 bool hasFastAccess() const { return expr.hasFastAccess(); } \
373 KOKKOS_INLINE_FUNCTION \
374 bool isPassive() const { return expr.isPassive();} \
376 KOKKOS_INLINE_FUNCTION \
377 bool updateValue() const { return expr.updateValue(); } \
379 KOKKOS_INLINE_FUNCTION \
380 void cache() const { \
386 KOKKOS_INLINE_FUNCTION \
387 value_type val() const { \
391 KOKKOS_INLINE_FUNCTION \
392 value_type dx(int i) const { \
393 return expr.dx(i)*a; \
396 KOKKOS_INLINE_FUNCTION \
397 value_type fastAccessDx(int i) const { \
398 return expr.fastAccessDx(i)*a; \
404 mutable value_type v; \
405 mutable value_type a; \
408 template <typename T> \
409 KOKKOS_INLINE_FUNCTION \
410 Expr< OP< Expr<T> > > \
411 OPNAME (const Expr<T>& expr) \
413 typedef OP< Expr<T> > expr_t; \
415 return Expr<expr_t>(expr); \
430 a = value_type(1)/(std::log(value_type(10))*v),
434 a = value_type(1)/(value_type(2)*std::sqrt(v)),
438 a = (v == value_type(0.0) ? value_type(0.0) : value_type(value_type(1)/(value_type(2)*std::sqrt(v)))),
450 a = value_type(1)+std::tan(v)*std::tan(v),
454 a = value_type(-1)/std::sqrt(value_type(1)-v*v),
458 a = value_type(1)/std::sqrt(value_type(1)-v*v),
462 a = value_type(1)/(value_type(1)+v*v),
474 a = value_type(1)-std::tanh(v)*std::tanh(v),
478 a = value_type(1)/std::sqrt((v-value_type(1))*(v+value_type(1))),
482 a = value_type(1)/std::sqrt(value_type(1)+v*v),
486 a = value_type(1)/(value_type(1)-v*v),
488 #ifdef HAVE_SACADO_CXX11
491 a = value_type(1)/(value_type(3)*
std::cbrt(v*v)),
495 #undef FAD_UNARYOP_MACRO
507 template <
typename ExprT1,
typename ExprT2>
510 template <
typename ExprT1,
typename ExprT2>
511 class Expr< AdditionOp<ExprT1,ExprT2> > {
515 typedef typename ExprT1::value_type value_type_1;
516 typedef typename ExprT2::value_type value_type_2;
518 value_type_2>::type value_type;
520 typedef typename ExprT1::scalar_type scalar_type_1;
521 typedef typename ExprT2::scalar_type scalar_type_2;
523 scalar_type_2>::type scalar_type;
525 typedef typename ExprT1::base_expr_type base_expr_type_1;
526 typedef typename ExprT2::base_expr_type base_expr_type_2;
528 base_expr_type_2>::type base_expr_type;
531 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
532 expr1(expr1_), expr2(expr2_) {}
536 int sz1 = expr1.size(), sz2 = expr2.size();
537 return sz1 > sz2 ? sz1 : sz2;
541 bool updateValue()
const {
542 return expr1.updateValue() && expr2.updateValue();
552 value_type
val()
const {
553 return expr1.val()+expr2.val();
557 bool isLinear()
const {
558 return expr1.isLinear() && expr2.isLinear();
562 bool hasFastAccess()
const {
563 return expr1.hasFastAccess() && expr2.hasFastAccess();
567 const value_type
dx(
int i)
const {
568 return expr1.dx(i) + expr2.dx(i);
573 return expr1.fastAccessDx(i) + expr2.fastAccessDx(i);
583 template <
typename ExprT1,
typename T2>
584 class Expr< AdditionOp<ExprT1, ConstExpr<T2> > > {
588 typedef ConstExpr<T2> ExprT2;
589 typedef typename ExprT1::value_type value_type_1;
590 typedef typename ExprT2::value_type value_type_2;
592 value_type_2>::type value_type;
594 typedef typename ExprT1::scalar_type scalar_type_1;
595 typedef typename ExprT2::scalar_type scalar_type_2;
597 scalar_type_2>::type scalar_type;
599 typedef typename ExprT1::base_expr_type base_expr_type_1;
600 typedef typename ExprT2::base_expr_type base_expr_type_2;
602 base_expr_type_2>::type base_expr_type;
605 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
606 expr1(expr1_), expr2(expr2_) {}
614 bool updateValue()
const {
615 return expr1.updateValue();
624 value_type
val()
const {
625 return expr1.val() + expr2.val();
629 bool isLinear()
const {
630 return expr1.isLinear();
634 bool hasFastAccess()
const {
635 return expr1.hasFastAccess();
639 const value_type
dx(
int i)
const {
645 return expr1.fastAccessDx(i);
655 template <
typename T1,
typename ExprT2>
656 class Expr< AdditionOp< ConstExpr<T1>,ExprT2> > {
660 typedef ConstExpr<T1> ExprT1;
661 typedef typename ExprT1::value_type value_type_1;
662 typedef typename ExprT2::value_type value_type_2;
664 value_type_2>::type value_type;
666 typedef typename ExprT1::scalar_type scalar_type_1;
667 typedef typename ExprT2::scalar_type scalar_type_2;
669 scalar_type_2>::type scalar_type;
671 typedef typename ExprT1::base_expr_type base_expr_type_1;
672 typedef typename ExprT2::base_expr_type base_expr_type_2;
674 base_expr_type_2>::type base_expr_type;
677 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
678 expr1(expr1_), expr2(expr2_) {}
686 bool updateValue()
const {
687 return expr2.updateValue();
696 value_type
val()
const {
697 return expr1.val() + expr2.val();
701 bool isLinear()
const {
702 return expr2.isLinear();
706 bool hasFastAccess()
const {
707 return expr2.hasFastAccess();
711 const value_type
dx(
int i)
const {
717 return expr2.fastAccessDx(i);
731 template <
typename ExprT1,
typename ExprT2>
734 template <
typename ExprT1,
typename ExprT2>
735 class Expr< SubtractionOp<ExprT1,ExprT2> > {
739 typedef typename ExprT1::value_type value_type_1;
740 typedef typename ExprT2::value_type value_type_2;
742 value_type_2>::type value_type;
744 typedef typename ExprT1::scalar_type scalar_type_1;
745 typedef typename ExprT2::scalar_type scalar_type_2;
747 scalar_type_2>::type scalar_type;
749 typedef typename ExprT1::base_expr_type base_expr_type_1;
750 typedef typename ExprT2::base_expr_type base_expr_type_2;
752 base_expr_type_2>::type base_expr_type;
755 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
756 expr1(expr1_), expr2(expr2_) {}
760 int sz1 = expr1.size(), sz2 = expr2.size();
761 return sz1 > sz2 ? sz1 : sz2;
765 bool updateValue()
const {
766 return expr1.updateValue() && expr2.updateValue();
776 value_type
val()
const {
777 return expr1.val()-expr2.val();
781 bool isLinear()
const {
782 return expr1.isLinear() && expr2.isLinear();
786 bool hasFastAccess()
const {
787 return expr1.hasFastAccess() && expr2.hasFastAccess();
791 const value_type
dx(
int i)
const {
792 return expr1.dx(i) - expr2.dx(i);
797 return expr1.fastAccessDx(i) - expr2.fastAccessDx(i);
807 template <
typename ExprT1,
typename T2>
808 class Expr< SubtractionOp<ExprT1, ConstExpr<T2> > > {
812 typedef ConstExpr<T2> ExprT2;
813 typedef typename ExprT1::value_type value_type_1;
814 typedef typename ExprT2::value_type value_type_2;
816 value_type_2>::type value_type;
818 typedef typename ExprT1::scalar_type scalar_type_1;
819 typedef typename ExprT2::scalar_type scalar_type_2;
821 scalar_type_2>::type scalar_type;
823 typedef typename ExprT1::base_expr_type base_expr_type_1;
824 typedef typename ExprT2::base_expr_type base_expr_type_2;
826 base_expr_type_2>::type base_expr_type;
829 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
830 expr1(expr1_), expr2(expr2_) {}
838 bool updateValue()
const {
839 return expr1.updateValue();
848 value_type
val()
const {
849 return expr1.val() - expr2.val();
853 bool isLinear()
const {
854 return expr1.isLinear();
858 bool hasFastAccess()
const {
859 return expr1.hasFastAccess();
863 const value_type
dx(
int i)
const {
869 return expr1.fastAccessDx(i);
879 template <
typename T1,
typename ExprT2>
880 class Expr< SubtractionOp< ConstExpr<T1>,ExprT2> > {
884 typedef ConstExpr<T1> ExprT1;
885 typedef typename ExprT1::value_type value_type_1;
886 typedef typename ExprT2::value_type value_type_2;
888 value_type_2>::type value_type;
890 typedef typename ExprT1::scalar_type scalar_type_1;
891 typedef typename ExprT2::scalar_type scalar_type_2;
893 scalar_type_2>::type scalar_type;
895 typedef typename ExprT1::base_expr_type base_expr_type_1;
896 typedef typename ExprT2::base_expr_type base_expr_type_2;
898 base_expr_type_2>::type base_expr_type;
901 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
902 expr1(expr1_), expr2(expr2_) {}
910 bool updateValue()
const {
911 return expr2.updateValue();
920 value_type
val()
const {
921 return expr1.val() - expr2.val();
925 bool isLinear()
const {
926 return expr2.isLinear();
930 bool hasFastAccess()
const {
931 return expr2.hasFastAccess();
935 const value_type
dx(
int i)
const {
941 return -expr2.fastAccessDx(i);
955 template <
typename ExprT1,
typename ExprT2>
958 template <
typename ExprT1,
typename ExprT2>
959 class Expr< MultiplicationOp<ExprT1,ExprT2> > {
963 typedef typename ExprT1::value_type value_type_1;
964 typedef typename ExprT2::value_type value_type_2;
966 value_type_2>::type value_type;
968 typedef typename ExprT1::scalar_type scalar_type_1;
969 typedef typename ExprT2::scalar_type scalar_type_2;
971 scalar_type_2>::type scalar_type;
973 typedef typename ExprT1::base_expr_type base_expr_type_1;
974 typedef typename ExprT2::base_expr_type base_expr_type_2;
976 base_expr_type_2>::type base_expr_type;
979 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
980 expr1(expr1_), expr2(expr2_) {}
984 int sz1 = expr1.size(), sz2 = expr2.size();
985 return sz1 > sz2 ? sz1 : sz2;
989 bool updateValue()
const {
990 return expr1.updateValue() && expr2.updateValue();
1002 value_type
val()
const {
1007 bool isLinear()
const {
1012 bool hasFastAccess()
const {
1013 return expr1.hasFastAccess() && expr2.hasFastAccess();
1017 const value_type
dx(
int i)
const {
1018 if (expr1.size() > 0 && expr2.size() > 0)
1019 return v1*expr2.dx(i) + expr1.dx(i)*v2;
1020 else if (expr1.size() > 0)
1021 return expr1.dx(i)*v2;
1023 return v1*expr2.dx(i);
1028 return v1*expr2.fastAccessDx(i) + expr1.fastAccessDx(i)*v2;
1033 const ExprT1& expr1;
1034 const ExprT2& expr2;
1035 mutable value_type_1 v1;
1036 mutable value_type_2 v2;
1040 template <
typename ExprT1,
typename T2>
1041 class Expr< MultiplicationOp<ExprT1, ConstExpr<T2> > > {
1045 typedef ConstExpr<T2> ExprT2;
1046 typedef typename ExprT1::value_type value_type_1;
1047 typedef typename ExprT2::value_type value_type_2;
1049 value_type_2>::type value_type;
1051 typedef typename ExprT1::scalar_type scalar_type_1;
1052 typedef typename ExprT2::scalar_type scalar_type_2;
1054 scalar_type_2>::type scalar_type;
1056 typedef typename ExprT1::base_expr_type base_expr_type_1;
1057 typedef typename ExprT2::base_expr_type base_expr_type_2;
1059 base_expr_type_2>::type base_expr_type;
1062 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1063 expr1(expr1_), expr2(expr2_) {}
1067 return expr1.size();
1071 bool updateValue()
const {
1072 return expr1.updateValue();
1076 void cache()
const {
1081 value_type
val()
const {
1082 return expr1.val()*expr2.val();
1086 bool isLinear()
const {
1087 return expr1.isLinear();
1091 bool hasFastAccess()
const {
1092 return expr1.hasFastAccess();
1096 const value_type
dx(
int i)
const {
1097 return expr1.dx(i)*expr2.val();
1102 return expr1.fastAccessDx(i)*expr2.val();
1107 const ExprT1& expr1;
1112 template <
typename T1,
typename ExprT2>
1113 class Expr< MultiplicationOp< ConstExpr<T1>,ExprT2> > {
1117 typedef ConstExpr<T1> ExprT1;
1118 typedef typename ExprT1::value_type value_type_1;
1119 typedef typename ExprT2::value_type value_type_2;
1121 value_type_2>::type value_type;
1123 typedef typename ExprT1::scalar_type scalar_type_1;
1124 typedef typename ExprT2::scalar_type scalar_type_2;
1126 scalar_type_2>::type scalar_type;
1128 typedef typename ExprT1::base_expr_type base_expr_type_1;
1129 typedef typename ExprT2::base_expr_type base_expr_type_2;
1131 base_expr_type_2>::type base_expr_type;
1134 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1135 expr1(expr1_), expr2(expr2_) {}
1139 return expr2.size();
1143 bool updateValue()
const {
1144 return expr2.updateValue();
1148 void cache()
const {
1153 value_type
val()
const {
1154 return expr1.val()*expr2.val();
1158 bool isLinear()
const {
1159 return expr2.isLinear();
1163 bool hasFastAccess()
const {
1164 return expr2.hasFastAccess();
1168 const value_type
dx(
int i)
const {
1169 return expr1.val()*expr2.dx(i);
1174 return expr1.val()*expr2.fastAccessDx(i);
1180 const ExprT2& expr2;
1188 template <
typename ExprT1,
typename ExprT2>
1191 template <
typename ExprT1,
typename ExprT2>
1192 class Expr< DivisionOp<ExprT1,ExprT2> > {
1196 typedef typename ExprT1::value_type value_type_1;
1197 typedef typename ExprT2::value_type value_type_2;
1199 value_type_2>::type value_type;
1201 typedef typename ExprT1::scalar_type scalar_type_1;
1202 typedef typename ExprT2::scalar_type scalar_type_2;
1204 scalar_type_2>::type scalar_type;
1206 typedef typename ExprT1::base_expr_type base_expr_type_1;
1207 typedef typename ExprT2::base_expr_type base_expr_type_2;
1209 base_expr_type_2>::type base_expr_type;
1212 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1213 expr1(expr1_), expr2(expr2_) {}
1217 int sz1 = expr1.size(), sz2 = expr2.size();
1218 return sz1 > sz2 ? sz1 : sz2;
1222 bool updateValue()
const {
1223 return expr1.updateValue() && expr2.updateValue();
1227 void cache()
const {
1230 const value_type_1 v1 = expr1.val();
1231 const value_type_2 v2 = expr2.val();
1232 a = value_type(1)/v2;
1238 value_type
val()
const {
1243 bool isLinear()
const {
1248 bool hasFastAccess()
const {
1249 return expr1.hasFastAccess() && expr2.hasFastAccess();
1253 const value_type
dx(
int i)
const {
1254 if (expr1.size() > 0 && expr2.size() > 0)
1255 return expr1.dx(i)*
a + expr2.dx(i)*b;
1256 else if (expr1.size() > 0)
1257 return expr1.dx(i)*
a;
1259 return expr1.val()*b;
1264 return expr1.fastAccessDx(i)*
a + expr2.fastAccessDx(i)*b;
1269 const ExprT1& expr1;
1270 const ExprT2& expr2;
1271 mutable value_type v;
1272 mutable value_type
a;
1273 mutable value_type b;
1277 template <
typename ExprT1,
typename T2>
1278 class Expr< DivisionOp<ExprT1, ConstExpr<T2> > > {
1282 typedef ConstExpr<T2> ExprT2;
1283 typedef typename ExprT1::value_type value_type_1;
1284 typedef typename ExprT2::value_type value_type_2;
1286 value_type_2>::type value_type;
1288 typedef typename ExprT1::scalar_type scalar_type_1;
1289 typedef typename ExprT2::scalar_type scalar_type_2;
1291 scalar_type_2>::type scalar_type;
1293 typedef typename ExprT1::base_expr_type base_expr_type_1;
1294 typedef typename ExprT2::base_expr_type base_expr_type_2;
1296 base_expr_type_2>::type base_expr_type;
1299 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1300 expr1(expr1_), expr2(expr2_) {}
1304 return expr1.size();
1308 bool updateValue()
const {
1309 return expr1.updateValue();
1313 void cache()
const {
1315 const value_type_1 v1 = expr1.val();
1316 a = value_type(1)/expr2.val();
1321 value_type
val()
const {
1326 bool isLinear()
const {
1327 return expr1.isLinear();
1331 bool hasFastAccess()
const {
1332 return expr1.hasFastAccess();
1336 const value_type
dx(
int i)
const {
1337 return expr1.dx(i)*
a;
1342 return expr1.fastAccessDx(i)*
a;
1347 const ExprT1& expr1;
1349 mutable value_type v;
1350 mutable value_type
a;
1354 template <
typename T1,
typename ExprT2>
1355 class Expr< DivisionOp< ConstExpr<T1>,ExprT2> > {
1359 typedef ConstExpr<T1> ExprT1;
1360 typedef typename ExprT1::value_type value_type_1;
1361 typedef typename ExprT2::value_type value_type_2;
1363 value_type_2>::type value_type;
1365 typedef typename ExprT1::scalar_type scalar_type_1;
1366 typedef typename ExprT2::scalar_type scalar_type_2;
1368 scalar_type_2>::type scalar_type;
1370 typedef typename ExprT1::base_expr_type base_expr_type_1;
1371 typedef typename ExprT2::base_expr_type base_expr_type_2;
1373 base_expr_type_2>::type base_expr_type;
1376 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1377 expr1(expr1_), expr2(expr2_) {}
1381 return expr2.size();
1385 bool updateValue()
const {
1386 return expr2.updateValue();
1390 void cache()
const {
1392 const value_type_2 v2 = expr2.val();
1398 value_type
val()
const {
1403 bool isLinear()
const {
1408 bool hasFastAccess()
const {
1409 return expr2.hasFastAccess();
1413 const value_type
dx(
int i)
const {
1414 return expr2.dx(i)*b;
1419 return expr2.fastAccessDx(i)*b;
1425 const ExprT2& expr2;
1426 mutable value_type v;
1427 mutable value_type b;
1435 template <
typename ExprT1,
typename ExprT2>
1438 template <
typename ExprT1,
typename ExprT2>
1439 class Expr< Atan2Op<ExprT1,ExprT2> > {
1443 typedef typename ExprT1::value_type value_type_1;
1444 typedef typename ExprT2::value_type value_type_2;
1446 value_type_2>::type value_type;
1448 typedef typename ExprT1::scalar_type scalar_type_1;
1449 typedef typename ExprT2::scalar_type scalar_type_2;
1451 scalar_type_2>::type scalar_type;
1453 typedef typename ExprT1::base_expr_type base_expr_type_1;
1454 typedef typename ExprT2::base_expr_type base_expr_type_2;
1456 base_expr_type_2>::type base_expr_type;
1459 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1460 expr1(expr1_), expr2(expr2_) {}
1464 int sz1 = expr1.size(), sz2 = expr2.size();
1465 return sz1 > sz2 ? sz1 : sz2;
1469 bool updateValue()
const {
1470 return expr1.updateValue() && expr2.updateValue();
1474 void cache()
const {
1477 const value_type_1 v1 = expr1.val();
1478 const value_type_2 v2 = expr2.val();
1479 a = value_type(1)/(v1*v1 + v2*v2);
1486 value_type
val()
const {
1491 bool isLinear()
const {
1496 bool hasFastAccess()
const {
1497 return expr1.hasFastAccess() && expr2.hasFastAccess();
1501 const value_type
dx(
int i)
const {
1502 if (expr1.size() > 0 && expr2.size() > 0)
1503 return expr1.dx(i)*
a + expr2.dx(i)*b;
1504 else if (expr1.size() > 0)
1505 return expr1.dx(i)*
a;
1507 return expr1.val()*b;
1512 return expr1.fastAccessDx(i)*
a + expr2.fastAccessDx(i)*b;
1517 const ExprT1& expr1;
1518 const ExprT2& expr2;
1519 mutable value_type v;
1520 mutable value_type
a;
1521 mutable value_type b;
1525 template <
typename ExprT1,
typename T2>
1526 class Expr< Atan2Op<ExprT1, ConstExpr<T2> > > {
1530 typedef ConstExpr<T2> ExprT2;
1531 typedef typename ExprT1::value_type value_type_1;
1532 typedef typename ExprT2::value_type value_type_2;
1534 value_type_2>::type value_type;
1536 typedef typename ExprT1::scalar_type scalar_type_1;
1537 typedef typename ExprT2::scalar_type scalar_type_2;
1539 scalar_type_2>::type scalar_type;
1541 typedef typename ExprT1::base_expr_type base_expr_type_1;
1542 typedef typename ExprT2::base_expr_type base_expr_type_2;
1544 base_expr_type_2>::type base_expr_type;
1547 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1548 expr1(expr1_), expr2(expr2_) {}
1552 return expr1.size();
1556 bool updateValue()
const {
1557 return expr1.updateValue();
1561 void cache()
const {
1563 const value_type_1 v1 = expr1.val();
1564 const value_type_2 v2 = expr2.val();
1565 a = v2/(v1*v1 + v2*v2);
1570 value_type
val()
const {
1575 bool isLinear()
const {
1580 bool hasFastAccess()
const {
1581 return expr1.hasFastAccess();
1585 const value_type
dx(
int i)
const {
1586 return expr1.dx(i)*
a;
1591 return expr1.fastAccessDx(i)*
a;
1596 const ExprT1& expr1;
1598 mutable value_type v;
1599 mutable value_type
a;
1603 template <
typename T1,
typename ExprT2>
1604 class Expr< Atan2Op< ConstExpr<T1>,ExprT2> > {
1608 typedef ConstExpr<T1> ExprT1;
1609 typedef typename ExprT1::value_type value_type_1;
1610 typedef typename ExprT2::value_type value_type_2;
1612 value_type_2>::type value_type;
1614 typedef typename ExprT1::scalar_type scalar_type_1;
1615 typedef typename ExprT2::scalar_type scalar_type_2;
1617 scalar_type_2>::type scalar_type;
1619 typedef typename ExprT1::base_expr_type base_expr_type_1;
1620 typedef typename ExprT2::base_expr_type base_expr_type_2;
1622 base_expr_type_2>::type base_expr_type;
1625 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1626 expr1(expr1_), expr2(expr2_) {}
1630 return expr2.size();
1634 bool updateValue()
const {
1635 return expr2.updateValue();
1639 void cache()
const {
1641 const value_type_1 v1 = expr1.val();
1642 const value_type_2 v2 = expr2.val();
1643 b = -v1/(v1*v1 + v2*v2);
1648 value_type
val()
const {
1653 bool isLinear()
const {
1658 bool hasFastAccess()
const {
1659 return expr2.hasFastAccess();
1663 const value_type
dx(
int i)
const {
1664 return expr2.dx(i)*b;
1669 return expr2.fastAccessDx(i)*b;
1675 const ExprT2& expr2;
1676 mutable value_type v;
1677 mutable value_type b;
1685 template <
typename ExprT1,
typename ExprT2>
1688 template <
typename ExprT1,
typename ExprT2>
1689 class Expr< PowerOp<ExprT1,ExprT2> > {
1693 typedef typename ExprT1::value_type value_type_1;
1694 typedef typename ExprT2::value_type value_type_2;
1696 value_type_2>::type value_type;
1698 typedef typename ExprT1::scalar_type scalar_type_1;
1699 typedef typename ExprT2::scalar_type scalar_type_2;
1701 scalar_type_2>::type scalar_type;
1703 typedef typename ExprT1::base_expr_type base_expr_type_1;
1704 typedef typename ExprT2::base_expr_type base_expr_type_2;
1706 base_expr_type_2>::type base_expr_type;
1709 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1710 expr1(expr1_), expr2(expr2_) {}
1714 int sz1 = expr1.size(), sz2 = expr2.size();
1715 return sz1 > sz2 ? sz1 : sz2;
1719 bool updateValue()
const {
1720 return expr1.updateValue() && expr2.updateValue();
1724 void cache()
const {
1727 const value_type_1 v1 = expr1.val();
1728 const value_type_2 v2 = expr2.val();
1730 if (v1 == value_type(0)) {
1741 value_type
val()
const {
1746 bool isLinear()
const {
1751 bool hasFastAccess()
const {
1752 return expr1.hasFastAccess() && expr2.hasFastAccess();
1756 const value_type
dx(
int i)
const {
1757 if (expr1.size() > 0 && expr2.size() > 0)
1758 return expr1.dx(i)*
a + expr2.dx(i)*b;
1759 else if (expr1.size() > 0)
1760 return expr1.dx(i)*
a;
1762 return expr1.val()*b;
1767 return expr1.fastAccessDx(i)*
a + expr2.fastAccessDx(i)*b;
1772 const ExprT1& expr1;
1773 const ExprT2& expr2;
1774 mutable value_type v;
1775 mutable value_type
a;
1776 mutable value_type b;
1780 template <
typename ExprT1,
typename T2>
1781 class Expr< PowerOp<ExprT1, ConstExpr<T2> > > {
1785 typedef ConstExpr<T2> ExprT2;
1786 typedef typename ExprT1::value_type value_type_1;
1787 typedef typename ExprT2::value_type value_type_2;
1789 value_type_2>::type value_type;
1791 typedef typename ExprT1::scalar_type scalar_type_1;
1792 typedef typename ExprT2::scalar_type scalar_type_2;
1794 scalar_type_2>::type scalar_type;
1796 typedef typename ExprT1::base_expr_type base_expr_type_1;
1797 typedef typename ExprT2::base_expr_type base_expr_type_2;
1799 base_expr_type_2>::type base_expr_type;
1802 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1803 expr1(expr1_), expr2(expr2_) {}
1807 return expr1.size();
1811 bool updateValue()
const {
1812 return expr1.updateValue();
1816 void cache()
const {
1818 const value_type_1 v1 = expr1.val();
1819 const value_type_2 v2 = expr2.val();
1821 if (v1 == value_type_1(0)) {
1830 value_type
val()
const {
1835 bool isLinear()
const {
1840 bool hasFastAccess()
const {
1841 return expr1.hasFastAccess();
1845 const value_type
dx(
int i)
const {
1846 return expr1.dx(i)*
a;
1851 return expr1.fastAccessDx(i)*
a;
1856 const ExprT1& expr1;
1858 mutable value_type v;
1859 mutable value_type
a;
1863 template <
typename T1,
typename ExprT2>
1864 class Expr< PowerOp< ConstExpr<T1>,ExprT2> > {
1868 typedef ConstExpr<T1> ExprT1;
1869 typedef typename ExprT1::value_type value_type_1;
1870 typedef typename ExprT2::value_type value_type_2;
1872 value_type_2>::type value_type;
1874 typedef typename ExprT1::scalar_type scalar_type_1;
1875 typedef typename ExprT2::scalar_type scalar_type_2;
1877 scalar_type_2>::type scalar_type;
1879 typedef typename ExprT1::base_expr_type base_expr_type_1;
1880 typedef typename ExprT2::base_expr_type base_expr_type_2;
1882 base_expr_type_2>::type base_expr_type;
1885 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1886 expr1(expr1_), expr2(expr2_) {}
1890 return expr2.size();
1894 bool updateValue()
const {
1895 return expr2.updateValue();
1899 void cache()
const {
1901 const value_type_1 v1 = expr1.val();
1902 const value_type_2 v2 = expr2.val();
1904 if (v1 == value_type(0)) {
1913 value_type
val()
const {
1918 bool isLinear()
const {
1923 bool hasFastAccess()
const {
1924 return expr2.hasFastAccess();
1928 const value_type
dx(
int i)
const {
1929 return expr2.dx(i)*b;
1934 return expr2.fastAccessDx(i)*b;
1940 const ExprT2& expr2;
1941 mutable value_type v;
1942 mutable value_type b;
1950 template <
typename ExprT1,
typename ExprT2>
1953 template <
typename ExprT1,
typename ExprT2>
1954 class Expr< MaxOp<ExprT1,ExprT2> > {
1958 typedef typename ExprT1::value_type value_type_1;
1959 typedef typename ExprT2::value_type value_type_2;
1961 value_type_2>::type value_type;
1963 typedef typename ExprT1::scalar_type scalar_type_1;
1964 typedef typename ExprT2::scalar_type scalar_type_2;
1966 scalar_type_2>::type scalar_type;
1968 typedef typename ExprT1::base_expr_type base_expr_type_1;
1969 typedef typename ExprT2::base_expr_type base_expr_type_2;
1971 base_expr_type_2>::type base_expr_type;
1974 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1975 expr1(expr1_), expr2(expr2_) {}
1979 int sz1 = expr1.size(), sz2 = expr2.size();
1980 return sz1 > sz2 ? sz1 : sz2;
1984 bool updateValue()
const {
1985 return expr1.updateValue() && expr2.updateValue();
1989 void cache()
const {
1992 const value_type_1 v1 = expr1.val();
1993 const value_type_2 v2 = expr2.val();
1994 max_v1 = (v1 >= v2);
1995 v = max_v1 ? v1 : v2;
1999 value_type
val()
const {
2004 bool isLinear()
const {
2009 bool hasFastAccess()
const {
2010 return expr1.hasFastAccess() && expr2.hasFastAccess();
2014 const value_type
dx(
int i)
const {
2015 return max_v1 ? expr1.dx(i) : expr2.dx(i);
2020 return max_v1 ? expr1.fastAccessDx(i) : expr2.fastAccessDx(i);
2025 const ExprT1& expr1;
2026 const ExprT2& expr2;
2027 mutable value_type v;
2028 mutable bool max_v1;
2032 template <
typename ExprT1,
typename T2>
2033 class Expr< MaxOp<ExprT1, ConstExpr<T2> > > {
2037 typedef ConstExpr<T2> ExprT2;
2038 typedef typename ExprT1::value_type value_type_1;
2039 typedef typename ExprT2::value_type value_type_2;
2041 value_type_2>::type value_type;
2043 typedef typename ExprT1::scalar_type scalar_type_1;
2044 typedef typename ExprT2::scalar_type scalar_type_2;
2046 scalar_type_2>::type scalar_type;
2048 typedef typename ExprT1::base_expr_type base_expr_type_1;
2049 typedef typename ExprT2::base_expr_type base_expr_type_2;
2051 base_expr_type_2>::type base_expr_type;
2054 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2055 expr1(expr1_), expr2(expr2_) {}
2059 return expr1.size();
2063 bool updateValue()
const {
2064 return expr1.updateValue();
2068 void cache()
const {
2070 const value_type_1 v1 = expr1.val();
2071 const value_type_2 v2 = expr2.val();
2072 max_v1 = (v1 >= v2);
2073 v = max_v1 ? v1 : v2;
2077 value_type
val()
const {
2082 bool isLinear()
const {
2087 bool hasFastAccess()
const {
2088 return expr1.hasFastAccess();
2092 const value_type
dx(
int i)
const {
2093 return max_v1 ? expr1.dx(i) : value_type(0);
2098 return max_v1 ? expr1.fastAccessDx(i) : value_type(0);
2103 const ExprT1& expr1;
2105 mutable value_type v;
2106 mutable bool max_v1;
2110 template <
typename T1,
typename ExprT2>
2111 class Expr< MaxOp< ConstExpr<T1>,ExprT2> > {
2115 typedef ConstExpr<T1> ExprT1;
2116 typedef typename ExprT1::value_type value_type_1;
2117 typedef typename ExprT2::value_type value_type_2;
2119 value_type_2>::type value_type;
2121 typedef typename ExprT1::scalar_type scalar_type_1;
2122 typedef typename ExprT2::scalar_type scalar_type_2;
2124 scalar_type_2>::type scalar_type;
2126 typedef typename ExprT1::base_expr_type base_expr_type_1;
2127 typedef typename ExprT2::base_expr_type base_expr_type_2;
2129 base_expr_type_2>::type base_expr_type;
2132 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2133 expr1(expr1_), expr2(expr2_) {}
2137 return expr2.size();
2141 bool updateValue()
const {
2142 return expr2.updateValue();
2146 void cache()
const {
2148 const value_type_1 v1 = expr1.val();
2149 const value_type_2 v2 = expr2.val();
2150 max_v1 = (v1 >= v2);
2151 v = max_v1 ? v1 : v2;
2155 value_type
val()
const {
2160 bool isLinear()
const {
2165 bool hasFastAccess()
const {
2166 return expr2.hasFastAccess();
2170 const value_type
dx(
int i)
const {
2171 return max_v1 ? value_type(0) : expr2.dx(i);
2176 return max_v1 ? value_type(0) : expr2.fastAccessDx(i);
2182 const ExprT2& expr2;
2183 mutable value_type v;
2184 mutable bool max_v1;
2192 template <
typename ExprT1,
typename ExprT2>
2195 template <
typename ExprT1,
typename ExprT2>
2196 class Expr< MinOp<ExprT1,ExprT2> > {
2200 typedef typename ExprT1::value_type value_type_1;
2201 typedef typename ExprT2::value_type value_type_2;
2203 value_type_2>::type value_type;
2205 typedef typename ExprT1::scalar_type scalar_type_1;
2206 typedef typename ExprT2::scalar_type scalar_type_2;
2208 scalar_type_2>::type scalar_type;
2210 typedef typename ExprT1::base_expr_type base_expr_type_1;
2211 typedef typename ExprT2::base_expr_type base_expr_type_2;
2213 base_expr_type_2>::type base_expr_type;
2216 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2217 expr1(expr1_), expr2(expr2_) {}
2221 int sz1 = expr1.size(), sz2 = expr2.size();
2222 return sz1 > sz2 ? sz1 : sz2;
2226 bool updateValue()
const {
2227 return expr1.updateValue() && expr2.updateValue();
2231 void cache()
const {
2234 const value_type_1 v1 = expr1.val();
2235 const value_type_2 v2 = expr2.val();
2236 min_v1 = (v1 <= v2);
2237 v = min_v1 ? v1 : v2;
2241 value_type
val()
const {
2246 bool isLinear()
const {
2251 bool hasFastAccess()
const {
2252 return expr1.hasFastAccess() && expr2.hasFastAccess();
2256 const value_type
dx(
int i)
const {
2257 return min_v1 ? expr1.dx(i) : expr2.dx(i);
2262 return min_v1 ? expr1.fastAccessDx(i) : expr2.fastAccessDx(i);
2267 const ExprT1& expr1;
2268 const ExprT2& expr2;
2269 mutable value_type v;
2270 mutable bool min_v1;
2274 template <
typename ExprT1,
typename T2>
2275 class Expr< MinOp<ExprT1, ConstExpr<T2> > > {
2279 typedef ConstExpr<T2> ExprT2;
2280 typedef typename ExprT1::value_type value_type_1;
2281 typedef typename ExprT2::value_type value_type_2;
2283 value_type_2>::type value_type;
2285 typedef typename ExprT1::scalar_type scalar_type_1;
2286 typedef typename ExprT2::scalar_type scalar_type_2;
2288 scalar_type_2>::type scalar_type;
2290 typedef typename ExprT1::base_expr_type base_expr_type_1;
2291 typedef typename ExprT2::base_expr_type base_expr_type_2;
2293 base_expr_type_2>::type base_expr_type;
2296 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2297 expr1(expr1_), expr2(expr2_) {}
2301 return expr1.size();
2305 bool updateValue()
const {
2306 return expr1.updateValue();
2310 void cache()
const {
2312 const value_type_1 v1 = expr1.val();
2313 const value_type_2 v2 = expr2.val();
2314 min_v1 = (v1 <= v2);
2315 v = min_v1 ? v1 : v2;
2319 value_type
val()
const {
2324 bool isLinear()
const {
2329 bool hasFastAccess()
const {
2330 return expr1.hasFastAccess();
2334 const value_type
dx(
int i)
const {
2335 return min_v1 ? expr1.dx(i) : value_type(0);
2340 return min_v1 ? expr1.fastAccessDx(i) : value_type(0);
2345 const ExprT1& expr1;
2347 mutable value_type v;
2348 mutable bool min_v1;
2352 template <
typename T1,
typename ExprT2>
2353 class Expr< MinOp< ConstExpr<T1>,ExprT2> > {
2357 typedef ConstExpr<T1> ExprT1;
2358 typedef typename ExprT1::value_type value_type_1;
2359 typedef typename ExprT2::value_type value_type_2;
2361 value_type_2>::type value_type;
2363 typedef typename ExprT1::scalar_type scalar_type_1;
2364 typedef typename ExprT2::scalar_type scalar_type_2;
2366 scalar_type_2>::type scalar_type;
2368 typedef typename ExprT1::base_expr_type base_expr_type_1;
2369 typedef typename ExprT2::base_expr_type base_expr_type_2;
2371 base_expr_type_2>::type base_expr_type;
2374 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2375 expr1(expr1_), expr2(expr2_) {}
2379 return expr2.size();
2383 bool updateValue()
const {
2384 return expr2.updateValue();
2388 void cache()
const {
2390 const value_type_1 v1 = expr1.val();
2391 const value_type_2 v2 = expr2.val();
2392 min_v1 = (v1 <= v2);
2393 v = min_v1 ? v1 : v2;
2397 value_type
val()
const {
2402 bool isLinear()
const {
2407 bool hasFastAccess()
const {
2408 return expr2.hasFastAccess();
2412 const value_type
dx(
int i)
const {
2413 return min_v1 ? value_type(0) : expr2.dx(i);
2418 return min_v1 ? value_type(0) : expr2.fastAccessDx(i);
2424 const ExprT2& expr2;
2425 mutable value_type v;
2426 mutable bool min_v1;
2434 #define FAD_BINARYOP_MACRO(OPNAME,OP) \
2435 namespace Sacado { \
2436 namespace CacheFad { \
2438 template <typename T1, typename T2> \
2439 KOKKOS_INLINE_FUNCTION \
2440 SACADO_FAD_OP_ENABLE_EXPR_EXPR(OP) \
2441 OPNAME (const T1& expr1, const T2& expr2) \
2443 typedef OP< T1, T2 > expr_t; \
2445 return Expr<expr_t>(expr1, expr2); \
2448 template <typename T> \
2449 KOKKOS_INLINE_FUNCTION \
2450 Expr< OP< Expr<T>, Expr<T> > > \
2451 OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
2453 typedef OP< Expr<T>, Expr<T> > expr_t; \
2455 return Expr<expr_t>(expr1, expr2); \
2458 template <typename T> \
2459 KOKKOS_INLINE_FUNCTION \
2460 Expr< OP< ConstExpr<typename Expr<T>::value_type>, \
2462 OPNAME (const typename Expr<T>::value_type& c, \
2463 const Expr<T>& expr) \
2465 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
2466 typedef OP< ConstT, Expr<T> > expr_t; \
2468 return Expr<expr_t>(ConstT(c), expr); \
2471 template <typename T> \
2472 KOKKOS_INLINE_FUNCTION \
2473 Expr< OP< Expr<T>, \
2474 ConstExpr<typename Expr<T>::value_type> > > \
2475 OPNAME (const Expr<T>& expr, \
2476 const typename Expr<T>::value_type& c) \
2478 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
2479 typedef OP< Expr<T>, ConstT > expr_t; \
2481 return Expr<expr_t>(expr, ConstT(c)); \
2484 template <typename T> \
2485 KOKKOS_INLINE_FUNCTION \
2486 SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
2487 OPNAME (const typename Expr<T>::scalar_type& c, \
2488 const Expr<T>& expr) \
2490 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
2491 typedef OP< ConstT, Expr<T> > expr_t; \
2493 return Expr<expr_t>(ConstT(c), expr); \
2496 template <typename T> \
2497 KOKKOS_INLINE_FUNCTION \
2498 SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
2499 OPNAME (const Expr<T>& expr, \
2500 const typename Expr<T>::scalar_type& c) \
2502 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
2503 typedef OP< Expr<T>, ConstT > expr_t; \
2505 return Expr<expr_t>(expr, ConstT(c)); \
2520 #undef FAD_BINARYOP_MACRO
2524 #define FAD_RELOP_MACRO(OP) \
2525 namespace Sacado { \
2526 namespace CacheFad { \
2527 template <typename ExprT1, typename ExprT2> \
2528 KOKKOS_INLINE_FUNCTION \
2530 operator OP (const Expr<ExprT1>& expr1, \
2531 const Expr<ExprT2>& expr2) \
2535 return expr1.val() OP expr2.val(); \
2538 template <typename ExprT2> \
2539 KOKKOS_INLINE_FUNCTION \
2541 operator OP (const typename Expr<ExprT2>::value_type& a, \
2542 const Expr<ExprT2>& expr2) \
2545 return a OP expr2.val(); \
2548 template <typename ExprT1> \
2549 KOKKOS_INLINE_FUNCTION \
2551 operator OP (const Expr<ExprT1>& expr1, \
2552 const typename Expr<ExprT1>::value_type& b) \
2555 return expr1.val() OP b; \
2571 #undef FAD_RELOP_MACRO
2575 namespace CacheFad {
2577 template <
typename ExprT>
2582 return ! expr.val();
2592 namespace CacheFad {
2594 template <
typename ExprT>
2598 bool is_zero = (x.val() == 0.0);
2599 for (
int i=0; i<x.size(); i++)
2600 is_zero = is_zero && (x.dx(i) == 0.0);
2608 #define FAD_BOOL_MACRO(OP) \
2609 namespace Sacado { \
2610 namespace CacheFad { \
2611 template <typename ExprT1, typename ExprT2> \
2612 KOKKOS_INLINE_FUNCTION \
2614 operator OP (const Expr<ExprT1>& expr1, \
2615 const Expr<ExprT2>& expr2) \
2617 return toBool(expr1) OP toBool(expr2); \
2620 template <typename ExprT2> \
2621 KOKKOS_INLINE_FUNCTION \
2623 operator OP (const typename Expr<ExprT2>::value_type& a, \
2624 const Expr<ExprT2>& expr2) \
2626 return a OP toBool(expr2); \
2629 template <typename ExprT1> \
2630 KOKKOS_INLINE_FUNCTION \
2632 operator OP (const Expr<ExprT1>& expr1, \
2633 const typename Expr<ExprT1>::value_type& b) \
2635 return toBool(expr1) OP b; \
2643 #undef FAD_BOOL_MACRO
2649 namespace CacheFad {
2651 template <
typename ExprT>
2652 std::ostream& operator << (std::ostream& os, const Expr<ExprT>& x) {
2654 os << x.val() <<
" [";
2656 for (
int i=0; i< x.size(); i++) {
2657 os <<
" " << x.dx(i);
2668 #endif // SACADO_CACHEFAD_OPS_HPP
KOKKOS_INLINE_FUNCTION Expr(const ExprT &expr_)
#define FAD_RELOP_MACRO(OP)
ExprT::scalar_type scalar_type
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
KOKKOS_INLINE_FUNCTION value_type val() const
KOKKOS_INLINE_FUNCTION bool updateValue() const
#define FAD_UNARYOP_MACRO(OPNAME, OP, USING, VALUE, DX, FASTACCESSDX)
ExprT::value_type value_type
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION int size() const
ExprT::base_expr_type base_expr_type
KOKKOS_INLINE_FUNCTION int size() const
ExprT::scalar_type scalar_type
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MinOp
KOKKOS_INLINE_FUNCTION Expr< UnaryPlusOp< Expr< T > > > operator+(const Expr< T > &expr)
KOKKOS_INLINE_FUNCTION void cache() const
KOKKOS_INLINE_FUNCTION bool isLinear() const
KOKKOS_INLINE_FUNCTION void cache() const
KOKKOS_INLINE_FUNCTION bool toBool(const Expr< ExprT > &x)
KOKKOS_INLINE_FUNCTION bool isLinear() const
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
#define FAD_BOOL_MACRO(OP)
expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 MultiplicationOp
KOKKOS_INLINE_FUNCTION void cache() const
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)
ExprT::base_expr_type base_expr_type
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
KOKKOS_INLINE_FUNCTION void cache() const
KOKKOS_INLINE_FUNCTION bool updateValue() const
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) 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
ExprT::value_type value_type
#define KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION T safe_sqrt(const T &x)
ExprT::scalar_type scalar_type
KOKKOS_INLINE_FUNCTION bool isLinear() const
KOKKOS_INLINE_FUNCTION bool operator!(const Expr< ExprT > &expr)
#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)
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
KOKKOS_INLINE_FUNCTION Expr(const ExprT &expr_)
SimpleFad< ValueT > min(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
KOKKOS_INLINE_FUNCTION bool isLinear() const
KOKKOS_INLINE_FUNCTION value_type val() const
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
KOKKOS_INLINE_FUNCTION Expr(const ExprT &expr_)
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
KOKKOS_INLINE_FUNCTION bool updateValue() const
KOKKOS_INLINE_FUNCTION Expr(const ExprT &expr_)
atan2(expr1.val(), expr2.val())
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
ExprT::scalar_type scalar_type
KOKKOS_INLINE_FUNCTION value_type val() const
ExprT::value_type value_type
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
SimpleFad< ValueT > max(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
ExprT::base_expr_type base_expr_type
KOKKOS_INLINE_FUNCTION bool updateValue() const
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
KOKKOS_INLINE_FUNCTION Expr< AbsOp< Expr< T > > > abs(const Expr< T > &expr)
KOKKOS_INLINE_FUNCTION Expr< FAbsOp< Expr< T > > > fabs(const Expr< T > &expr)
KOKKOS_INLINE_FUNCTION value_type val() const
KOKKOS_INLINE_FUNCTION Expr< UnaryMinusOp< Expr< T > > > operator-(const Expr< T > &expr)
KOKKOS_INLINE_FUNCTION const value_type dx(int i) const
Wrapper for a generic expression template.
ExprT::value_type value_type
KOKKOS_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT::base_expr_type base_expr_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 PowerOp