52 #ifndef SACADO_CACHEFAD_OPS_HPP
53 #define SACADO_CACHEFAD_OPS_HPP
67 template <
typename ExprT>
70 template <
typename ExprT>
79 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 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 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 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 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)),
446 a = value_type(1)+std::tan(v)*std::tan(v),
450 a = value_type(-1)/std::sqrt(value_type(1)-v*v),
454 a = value_type(1)/std::sqrt(value_type(1)-v*v),
458 a = value_type(1)/(value_type(1)+v*v),
470 a = value_type(1)/(std::cosh(v)*std::cosh(v)),
474 a = value_type(1)/std::sqrt((v-value_type(1))*(v+value_type(1))),
478 a = value_type(1)/std::sqrt(value_type(1)+v*v),
482 a = value_type(1)/(value_type(1)-v*v),
484 #ifdef HAVE_SACADO_CXX11
487 a = value_type(1)/(value_type(3)*
std::cbrt(v*v)),
491 #undef FAD_UNARYOP_MACRO
503 template <
typename ExprT1,
typename ExprT2>
506 template <
typename ExprT1,
typename ExprT2>
507 class Expr< AdditionOp<ExprT1,ExprT2> > {
511 typedef typename ExprT1::value_type value_type_1;
512 typedef typename ExprT2::value_type value_type_2;
514 value_type_2>::type value_type;
516 typedef typename ExprT1::scalar_type scalar_type_1;
517 typedef typename ExprT2::scalar_type scalar_type_2;
519 scalar_type_2>::type scalar_type;
521 typedef typename ExprT1::base_expr_type base_expr_type_1;
522 typedef typename ExprT2::base_expr_type base_expr_type_2;
524 base_expr_type_2>::type base_expr_type;
527 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
528 expr1(expr1_), expr2(expr2_) {}
532 int sz1 = expr1.size(), sz2 = expr2.size();
533 return sz1 > sz2 ? sz1 : sz2;
537 bool updateValue()
const {
538 return expr1.updateValue() && expr2.updateValue();
548 value_type
val()
const {
549 return expr1.val()+expr2.val();
553 bool isLinear()
const {
554 return expr1.isLinear() && expr2.isLinear();
558 bool hasFastAccess()
const {
559 return expr1.hasFastAccess() && expr2.hasFastAccess();
563 const value_type
dx(
int i)
const {
564 return expr1.dx(i) + expr2.dx(i);
569 return expr1.fastAccessDx(i) + expr2.fastAccessDx(i);
579 template <
typename ExprT1,
typename T2>
580 class Expr< AdditionOp<ExprT1, ConstExpr<T2> > > {
584 typedef ConstExpr<T2> ExprT2;
585 typedef typename ExprT1::value_type value_type_1;
586 typedef typename ExprT2::value_type value_type_2;
588 value_type_2>::type value_type;
590 typedef typename ExprT1::scalar_type scalar_type_1;
591 typedef typename ExprT2::scalar_type scalar_type_2;
593 scalar_type_2>::type scalar_type;
595 typedef typename ExprT1::base_expr_type base_expr_type_1;
596 typedef typename ExprT2::base_expr_type base_expr_type_2;
598 base_expr_type_2>::type base_expr_type;
601 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
602 expr1(expr1_), expr2(expr2_) {}
610 bool updateValue()
const {
611 return expr1.updateValue();
620 value_type
val()
const {
621 return expr1.val() + expr2.val();
625 bool isLinear()
const {
626 return expr1.isLinear();
630 bool hasFastAccess()
const {
631 return expr1.hasFastAccess();
635 const value_type
dx(
int i)
const {
641 return expr1.fastAccessDx(i);
651 template <
typename T1,
typename ExprT2>
652 class Expr< AdditionOp< ConstExpr<T1>,ExprT2> > {
656 typedef ConstExpr<T1> ExprT1;
657 typedef typename ExprT1::value_type value_type_1;
658 typedef typename ExprT2::value_type value_type_2;
660 value_type_2>::type value_type;
662 typedef typename ExprT1::scalar_type scalar_type_1;
663 typedef typename ExprT2::scalar_type scalar_type_2;
665 scalar_type_2>::type scalar_type;
667 typedef typename ExprT1::base_expr_type base_expr_type_1;
668 typedef typename ExprT2::base_expr_type base_expr_type_2;
670 base_expr_type_2>::type base_expr_type;
673 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
674 expr1(expr1_), expr2(expr2_) {}
682 bool updateValue()
const {
683 return expr2.updateValue();
692 value_type
val()
const {
693 return expr1.val() + expr2.val();
697 bool isLinear()
const {
698 return expr2.isLinear();
702 bool hasFastAccess()
const {
703 return expr2.hasFastAccess();
707 const value_type
dx(
int i)
const {
713 return expr2.fastAccessDx(i);
727 template <
typename ExprT1,
typename ExprT2>
730 template <
typename ExprT1,
typename ExprT2>
731 class Expr< SubtractionOp<ExprT1,ExprT2> > {
735 typedef typename ExprT1::value_type value_type_1;
736 typedef typename ExprT2::value_type value_type_2;
738 value_type_2>::type value_type;
740 typedef typename ExprT1::scalar_type scalar_type_1;
741 typedef typename ExprT2::scalar_type scalar_type_2;
743 scalar_type_2>::type scalar_type;
745 typedef typename ExprT1::base_expr_type base_expr_type_1;
746 typedef typename ExprT2::base_expr_type base_expr_type_2;
748 base_expr_type_2>::type base_expr_type;
751 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
752 expr1(expr1_), expr2(expr2_) {}
756 int sz1 = expr1.size(), sz2 = expr2.size();
757 return sz1 > sz2 ? sz1 : sz2;
761 bool updateValue()
const {
762 return expr1.updateValue() && expr2.updateValue();
772 value_type
val()
const {
773 return expr1.val()-expr2.val();
777 bool isLinear()
const {
778 return expr1.isLinear() && expr2.isLinear();
782 bool hasFastAccess()
const {
783 return expr1.hasFastAccess() && expr2.hasFastAccess();
787 const value_type
dx(
int i)
const {
788 return expr1.dx(i) - expr2.dx(i);
793 return expr1.fastAccessDx(i) - expr2.fastAccessDx(i);
803 template <
typename ExprT1,
typename T2>
804 class Expr< SubtractionOp<ExprT1, ConstExpr<T2> > > {
808 typedef ConstExpr<T2> ExprT2;
809 typedef typename ExprT1::value_type value_type_1;
810 typedef typename ExprT2::value_type value_type_2;
812 value_type_2>::type value_type;
814 typedef typename ExprT1::scalar_type scalar_type_1;
815 typedef typename ExprT2::scalar_type scalar_type_2;
817 scalar_type_2>::type scalar_type;
819 typedef typename ExprT1::base_expr_type base_expr_type_1;
820 typedef typename ExprT2::base_expr_type base_expr_type_2;
822 base_expr_type_2>::type base_expr_type;
825 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
826 expr1(expr1_), expr2(expr2_) {}
834 bool updateValue()
const {
835 return expr1.updateValue();
844 value_type
val()
const {
845 return expr1.val() - expr2.val();
849 bool isLinear()
const {
850 return expr1.isLinear();
854 bool hasFastAccess()
const {
855 return expr1.hasFastAccess();
859 const value_type
dx(
int i)
const {
865 return expr1.fastAccessDx(i);
875 template <
typename T1,
typename ExprT2>
876 class Expr< SubtractionOp< ConstExpr<T1>,ExprT2> > {
880 typedef ConstExpr<T1> ExprT1;
881 typedef typename ExprT1::value_type value_type_1;
882 typedef typename ExprT2::value_type value_type_2;
884 value_type_2>::type value_type;
886 typedef typename ExprT1::scalar_type scalar_type_1;
887 typedef typename ExprT2::scalar_type scalar_type_2;
889 scalar_type_2>::type scalar_type;
891 typedef typename ExprT1::base_expr_type base_expr_type_1;
892 typedef typename ExprT2::base_expr_type base_expr_type_2;
894 base_expr_type_2>::type base_expr_type;
897 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
898 expr1(expr1_), expr2(expr2_) {}
906 bool updateValue()
const {
907 return expr2.updateValue();
916 value_type
val()
const {
917 return expr1.val() - expr2.val();
921 bool isLinear()
const {
922 return expr2.isLinear();
926 bool hasFastAccess()
const {
927 return expr2.hasFastAccess();
931 const value_type
dx(
int i)
const {
937 return -expr2.fastAccessDx(i);
951 template <
typename ExprT1,
typename ExprT2>
954 template <
typename ExprT1,
typename ExprT2>
955 class Expr< MultiplicationOp<ExprT1,ExprT2> > {
959 typedef typename ExprT1::value_type value_type_1;
960 typedef typename ExprT2::value_type value_type_2;
962 value_type_2>::type value_type;
964 typedef typename ExprT1::scalar_type scalar_type_1;
965 typedef typename ExprT2::scalar_type scalar_type_2;
967 scalar_type_2>::type scalar_type;
969 typedef typename ExprT1::base_expr_type base_expr_type_1;
970 typedef typename ExprT2::base_expr_type base_expr_type_2;
972 base_expr_type_2>::type base_expr_type;
975 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
976 expr1(expr1_), expr2(expr2_) {}
980 int sz1 = expr1.size(), sz2 = expr2.size();
981 return sz1 > sz2 ? sz1 : sz2;
985 bool updateValue()
const {
986 return expr1.updateValue() && expr2.updateValue();
998 value_type
val()
const {
1003 bool isLinear()
const {
1008 bool hasFastAccess()
const {
1009 return expr1.hasFastAccess() && expr2.hasFastAccess();
1013 const value_type
dx(
int i)
const {
1014 if (expr1.size() > 0 && expr2.size() > 0)
1015 return v1*expr2.dx(i) + expr1.dx(i)*v2;
1016 else if (expr1.size() > 0)
1017 return expr1.dx(i)*v2;
1019 return v1*expr2.dx(i);
1024 return v1*expr2.fastAccessDx(i) + expr1.fastAccessDx(i)*v2;
1029 const ExprT1& expr1;
1030 const ExprT2& expr2;
1031 mutable value_type_1 v1;
1032 mutable value_type_2 v2;
1036 template <
typename ExprT1,
typename T2>
1037 class Expr< MultiplicationOp<ExprT1, ConstExpr<T2> > > {
1041 typedef ConstExpr<T2> ExprT2;
1042 typedef typename ExprT1::value_type value_type_1;
1043 typedef typename ExprT2::value_type value_type_2;
1045 value_type_2>::type value_type;
1047 typedef typename ExprT1::scalar_type scalar_type_1;
1048 typedef typename ExprT2::scalar_type scalar_type_2;
1050 scalar_type_2>::type scalar_type;
1052 typedef typename ExprT1::base_expr_type base_expr_type_1;
1053 typedef typename ExprT2::base_expr_type base_expr_type_2;
1055 base_expr_type_2>::type base_expr_type;
1058 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1059 expr1(expr1_), expr2(expr2_) {}
1063 return expr1.size();
1067 bool updateValue()
const {
1068 return expr1.updateValue();
1072 void cache()
const {
1077 value_type
val()
const {
1078 return expr1.val()*expr2.val();
1082 bool isLinear()
const {
1083 return expr1.isLinear();
1087 bool hasFastAccess()
const {
1088 return expr1.hasFastAccess();
1092 const value_type
dx(
int i)
const {
1093 return expr1.dx(i)*expr2.val();
1098 return expr1.fastAccessDx(i)*expr2.val();
1103 const ExprT1& expr1;
1108 template <
typename T1,
typename ExprT2>
1109 class Expr< MultiplicationOp< ConstExpr<T1>,ExprT2> > {
1113 typedef ConstExpr<T1> ExprT1;
1114 typedef typename ExprT1::value_type value_type_1;
1115 typedef typename ExprT2::value_type value_type_2;
1117 value_type_2>::type value_type;
1119 typedef typename ExprT1::scalar_type scalar_type_1;
1120 typedef typename ExprT2::scalar_type scalar_type_2;
1122 scalar_type_2>::type scalar_type;
1124 typedef typename ExprT1::base_expr_type base_expr_type_1;
1125 typedef typename ExprT2::base_expr_type base_expr_type_2;
1127 base_expr_type_2>::type base_expr_type;
1130 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1131 expr1(expr1_), expr2(expr2_) {}
1135 return expr2.size();
1139 bool updateValue()
const {
1140 return expr2.updateValue();
1144 void cache()
const {
1149 value_type
val()
const {
1150 return expr1.val()*expr2.val();
1154 bool isLinear()
const {
1155 return expr2.isLinear();
1159 bool hasFastAccess()
const {
1160 return expr2.hasFastAccess();
1164 const value_type
dx(
int i)
const {
1165 return expr1.val()*expr2.dx(i);
1170 return expr1.val()*expr2.fastAccessDx(i);
1176 const ExprT2& expr2;
1184 template <
typename ExprT1,
typename ExprT2>
1187 template <
typename ExprT1,
typename ExprT2>
1188 class Expr< DivisionOp<ExprT1,ExprT2> > {
1192 typedef typename ExprT1::value_type value_type_1;
1193 typedef typename ExprT2::value_type value_type_2;
1195 value_type_2>::type value_type;
1197 typedef typename ExprT1::scalar_type scalar_type_1;
1198 typedef typename ExprT2::scalar_type scalar_type_2;
1200 scalar_type_2>::type scalar_type;
1202 typedef typename ExprT1::base_expr_type base_expr_type_1;
1203 typedef typename ExprT2::base_expr_type base_expr_type_2;
1205 base_expr_type_2>::type base_expr_type;
1208 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1209 expr1(expr1_), expr2(expr2_) {}
1213 int sz1 = expr1.size(), sz2 = expr2.size();
1214 return sz1 > sz2 ? sz1 : sz2;
1218 bool updateValue()
const {
1219 return expr1.updateValue() && expr2.updateValue();
1223 void cache()
const {
1226 const value_type_1 v1 = expr1.val();
1227 const value_type_2 v2 = expr2.val();
1228 a = value_type(1)/v2;
1234 value_type
val()
const {
1239 bool isLinear()
const {
1244 bool hasFastAccess()
const {
1245 return expr1.hasFastAccess() && expr2.hasFastAccess();
1249 const value_type
dx(
int i)
const {
1250 if (expr1.size() > 0 && expr2.size() > 0)
1251 return expr1.dx(i)*
a + expr2.dx(i)*b;
1252 else if (expr1.size() > 0)
1253 return expr1.dx(i)*
a;
1255 return expr1.val()*b;
1260 return expr1.fastAccessDx(i)*
a + expr2.fastAccessDx(i)*b;
1265 const ExprT1& expr1;
1266 const ExprT2& expr2;
1267 mutable value_type v;
1268 mutable value_type
a;
1269 mutable value_type b;
1273 template <
typename ExprT1,
typename T2>
1274 class Expr< DivisionOp<ExprT1, ConstExpr<T2> > > {
1278 typedef ConstExpr<T2> ExprT2;
1279 typedef typename ExprT1::value_type value_type_1;
1280 typedef typename ExprT2::value_type value_type_2;
1282 value_type_2>::type value_type;
1284 typedef typename ExprT1::scalar_type scalar_type_1;
1285 typedef typename ExprT2::scalar_type scalar_type_2;
1287 scalar_type_2>::type scalar_type;
1289 typedef typename ExprT1::base_expr_type base_expr_type_1;
1290 typedef typename ExprT2::base_expr_type base_expr_type_2;
1292 base_expr_type_2>::type base_expr_type;
1295 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1296 expr1(expr1_), expr2(expr2_) {}
1300 return expr1.size();
1304 bool updateValue()
const {
1305 return expr1.updateValue();
1309 void cache()
const {
1311 const value_type_1 v1 = expr1.val();
1312 a = value_type(1)/expr2.val();
1317 value_type
val()
const {
1322 bool isLinear()
const {
1323 return expr1.isLinear();
1327 bool hasFastAccess()
const {
1328 return expr1.hasFastAccess();
1332 const value_type
dx(
int i)
const {
1333 return expr1.dx(i)*
a;
1338 return expr1.fastAccessDx(i)*
a;
1343 const ExprT1& expr1;
1345 mutable value_type v;
1346 mutable value_type
a;
1350 template <
typename T1,
typename ExprT2>
1351 class Expr< DivisionOp< ConstExpr<T1>,ExprT2> > {
1355 typedef ConstExpr<T1> ExprT1;
1356 typedef typename ExprT1::value_type value_type_1;
1357 typedef typename ExprT2::value_type value_type_2;
1359 value_type_2>::type value_type;
1361 typedef typename ExprT1::scalar_type scalar_type_1;
1362 typedef typename ExprT2::scalar_type scalar_type_2;
1364 scalar_type_2>::type scalar_type;
1366 typedef typename ExprT1::base_expr_type base_expr_type_1;
1367 typedef typename ExprT2::base_expr_type base_expr_type_2;
1369 base_expr_type_2>::type base_expr_type;
1372 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1373 expr1(expr1_), expr2(expr2_) {}
1377 return expr2.size();
1381 bool updateValue()
const {
1382 return expr2.updateValue();
1386 void cache()
const {
1388 const value_type_2 v2 = expr2.val();
1394 value_type
val()
const {
1399 bool isLinear()
const {
1404 bool hasFastAccess()
const {
1405 return expr2.hasFastAccess();
1409 const value_type
dx(
int i)
const {
1410 return expr2.dx(i)*b;
1415 return expr2.fastAccessDx(i)*b;
1421 const ExprT2& expr2;
1422 mutable value_type v;
1423 mutable value_type b;
1431 template <
typename ExprT1,
typename ExprT2>
1434 template <
typename ExprT1,
typename ExprT2>
1435 class Expr< Atan2Op<ExprT1,ExprT2> > {
1439 typedef typename ExprT1::value_type value_type_1;
1440 typedef typename ExprT2::value_type value_type_2;
1442 value_type_2>::type value_type;
1444 typedef typename ExprT1::scalar_type scalar_type_1;
1445 typedef typename ExprT2::scalar_type scalar_type_2;
1447 scalar_type_2>::type scalar_type;
1449 typedef typename ExprT1::base_expr_type base_expr_type_1;
1450 typedef typename ExprT2::base_expr_type base_expr_type_2;
1452 base_expr_type_2>::type base_expr_type;
1455 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1456 expr1(expr1_), expr2(expr2_) {}
1460 int sz1 = expr1.size(), sz2 = expr2.size();
1461 return sz1 > sz2 ? sz1 : sz2;
1465 bool updateValue()
const {
1466 return expr1.updateValue() && expr2.updateValue();
1470 void cache()
const {
1473 const value_type_1 v1 = expr1.val();
1474 const value_type_2 v2 = expr2.val();
1475 a = value_type(1)/(v1*v1 + v2*v2);
1482 value_type
val()
const {
1487 bool isLinear()
const {
1492 bool hasFastAccess()
const {
1493 return expr1.hasFastAccess() && expr2.hasFastAccess();
1497 const value_type
dx(
int i)
const {
1498 if (expr1.size() > 0 && expr2.size() > 0)
1499 return expr1.dx(i)*
a + expr2.dx(i)*b;
1500 else if (expr1.size() > 0)
1501 return expr1.dx(i)*
a;
1503 return expr1.val()*b;
1508 return expr1.fastAccessDx(i)*
a + expr2.fastAccessDx(i)*b;
1513 const ExprT1& expr1;
1514 const ExprT2& expr2;
1515 mutable value_type v;
1516 mutable value_type
a;
1517 mutable value_type b;
1521 template <
typename ExprT1,
typename T2>
1522 class Expr< Atan2Op<ExprT1, ConstExpr<T2> > > {
1526 typedef ConstExpr<T2> ExprT2;
1527 typedef typename ExprT1::value_type value_type_1;
1528 typedef typename ExprT2::value_type value_type_2;
1530 value_type_2>::type value_type;
1532 typedef typename ExprT1::scalar_type scalar_type_1;
1533 typedef typename ExprT2::scalar_type scalar_type_2;
1535 scalar_type_2>::type scalar_type;
1537 typedef typename ExprT1::base_expr_type base_expr_type_1;
1538 typedef typename ExprT2::base_expr_type base_expr_type_2;
1540 base_expr_type_2>::type base_expr_type;
1543 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1544 expr1(expr1_), expr2(expr2_) {}
1548 return expr1.size();
1552 bool updateValue()
const {
1553 return expr1.updateValue();
1557 void cache()
const {
1559 const value_type_1 v1 = expr1.val();
1560 const value_type_2 v2 = expr2.val();
1561 a = v2/(v1*v1 + v2*v2);
1566 value_type
val()
const {
1571 bool isLinear()
const {
1576 bool hasFastAccess()
const {
1577 return expr1.hasFastAccess();
1581 const value_type
dx(
int i)
const {
1582 return expr1.dx(i)*
a;
1587 return expr1.fastAccessDx(i)*
a;
1592 const ExprT1& expr1;
1594 mutable value_type v;
1595 mutable value_type
a;
1599 template <
typename T1,
typename ExprT2>
1600 class Expr< Atan2Op< ConstExpr<T1>,ExprT2> > {
1604 typedef ConstExpr<T1> ExprT1;
1605 typedef typename ExprT1::value_type value_type_1;
1606 typedef typename ExprT2::value_type value_type_2;
1608 value_type_2>::type value_type;
1610 typedef typename ExprT1::scalar_type scalar_type_1;
1611 typedef typename ExprT2::scalar_type scalar_type_2;
1613 scalar_type_2>::type scalar_type;
1615 typedef typename ExprT1::base_expr_type base_expr_type_1;
1616 typedef typename ExprT2::base_expr_type base_expr_type_2;
1618 base_expr_type_2>::type base_expr_type;
1621 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1622 expr1(expr1_), expr2(expr2_) {}
1626 return expr2.size();
1630 bool updateValue()
const {
1631 return expr2.updateValue();
1635 void cache()
const {
1637 const value_type_1 v1 = expr1.val();
1638 const value_type_2 v2 = expr2.val();
1639 b = -v1/(v1*v1 + v2*v2);
1644 value_type
val()
const {
1649 bool isLinear()
const {
1654 bool hasFastAccess()
const {
1655 return expr2.hasFastAccess();
1659 const value_type
dx(
int i)
const {
1660 return expr2.dx(i)*b;
1665 return expr2.fastAccessDx(i)*b;
1671 const ExprT2& expr2;
1672 mutable value_type v;
1673 mutable value_type b;
1681 template <
typename ExprT1,
typename ExprT2>
1684 template <
typename ExprT1,
typename ExprT2>
1685 class Expr< PowerOp<ExprT1,ExprT2> > {
1689 typedef typename ExprT1::value_type value_type_1;
1690 typedef typename ExprT2::value_type value_type_2;
1692 value_type_2>::type value_type;
1694 typedef typename ExprT1::scalar_type scalar_type_1;
1695 typedef typename ExprT2::scalar_type scalar_type_2;
1697 scalar_type_2>::type scalar_type;
1699 typedef typename ExprT1::base_expr_type base_expr_type_1;
1700 typedef typename ExprT2::base_expr_type base_expr_type_2;
1702 base_expr_type_2>::type base_expr_type;
1705 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1706 expr1(expr1_), expr2(expr2_) {}
1710 int sz1 = expr1.size(), sz2 = expr2.size();
1711 return sz1 > sz2 ? sz1 : sz2;
1715 bool updateValue()
const {
1716 return expr1.updateValue() && expr2.updateValue();
1720 void cache()
const {
1723 const value_type_1 v1 = expr1.val();
1724 const value_type_2 v2 = expr2.val();
1726 if (v1 == value_type(0)) {
1737 value_type
val()
const {
1742 bool isLinear()
const {
1747 bool hasFastAccess()
const {
1748 return expr1.hasFastAccess() && expr2.hasFastAccess();
1752 const value_type
dx(
int i)
const {
1753 if (expr1.size() > 0 && expr2.size() > 0)
1754 return expr1.dx(i)*
a + expr2.dx(i)*b;
1755 else if (expr1.size() > 0)
1756 return expr1.dx(i)*
a;
1758 return expr1.val()*b;
1763 return expr1.fastAccessDx(i)*
a + expr2.fastAccessDx(i)*b;
1768 const ExprT1& expr1;
1769 const ExprT2& expr2;
1770 mutable value_type v;
1771 mutable value_type
a;
1772 mutable value_type b;
1776 template <
typename ExprT1,
typename T2>
1777 class Expr< PowerOp<ExprT1, ConstExpr<T2> > > {
1781 typedef ConstExpr<T2> ExprT2;
1782 typedef typename ExprT1::value_type value_type_1;
1783 typedef typename ExprT2::value_type value_type_2;
1785 value_type_2>::type value_type;
1787 typedef typename ExprT1::scalar_type scalar_type_1;
1788 typedef typename ExprT2::scalar_type scalar_type_2;
1790 scalar_type_2>::type scalar_type;
1792 typedef typename ExprT1::base_expr_type base_expr_type_1;
1793 typedef typename ExprT2::base_expr_type base_expr_type_2;
1795 base_expr_type_2>::type base_expr_type;
1798 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1799 expr1(expr1_), expr2(expr2_) {}
1803 return expr1.size();
1807 bool updateValue()
const {
1808 return expr1.updateValue();
1812 void cache()
const {
1814 const value_type_1 v1 = expr1.val();
1815 const value_type_2 v2 = expr2.val();
1817 if (v1 == value_type_1(0)) {
1826 value_type
val()
const {
1831 bool isLinear()
const {
1836 bool hasFastAccess()
const {
1837 return expr1.hasFastAccess();
1841 const value_type
dx(
int i)
const {
1842 return expr1.dx(i)*
a;
1847 return expr1.fastAccessDx(i)*
a;
1852 const ExprT1& expr1;
1854 mutable value_type v;
1855 mutable value_type
a;
1859 template <
typename T1,
typename ExprT2>
1860 class Expr< PowerOp< ConstExpr<T1>,ExprT2> > {
1864 typedef ConstExpr<T1> ExprT1;
1865 typedef typename ExprT1::value_type value_type_1;
1866 typedef typename ExprT2::value_type value_type_2;
1868 value_type_2>::type value_type;
1870 typedef typename ExprT1::scalar_type scalar_type_1;
1871 typedef typename ExprT2::scalar_type scalar_type_2;
1873 scalar_type_2>::type scalar_type;
1875 typedef typename ExprT1::base_expr_type base_expr_type_1;
1876 typedef typename ExprT2::base_expr_type base_expr_type_2;
1878 base_expr_type_2>::type base_expr_type;
1881 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1882 expr1(expr1_), expr2(expr2_) {}
1886 return expr2.size();
1890 bool updateValue()
const {
1891 return expr2.updateValue();
1895 void cache()
const {
1897 const value_type_1 v1 = expr1.val();
1898 const value_type_2 v2 = expr2.val();
1900 if (v1 == value_type(0)) {
1909 value_type
val()
const {
1914 bool isLinear()
const {
1919 bool hasFastAccess()
const {
1920 return expr2.hasFastAccess();
1924 const value_type
dx(
int i)
const {
1925 return expr2.dx(i)*b;
1930 return expr2.fastAccessDx(i)*b;
1936 const ExprT2& expr2;
1937 mutable value_type v;
1938 mutable value_type b;
1946 template <
typename ExprT1,
typename ExprT2>
1949 template <
typename ExprT1,
typename ExprT2>
1950 class Expr< MaxOp<ExprT1,ExprT2> > {
1954 typedef typename ExprT1::value_type value_type_1;
1955 typedef typename ExprT2::value_type value_type_2;
1957 value_type_2>::type value_type;
1959 typedef typename ExprT1::scalar_type scalar_type_1;
1960 typedef typename ExprT2::scalar_type scalar_type_2;
1962 scalar_type_2>::type scalar_type;
1964 typedef typename ExprT1::base_expr_type base_expr_type_1;
1965 typedef typename ExprT2::base_expr_type base_expr_type_2;
1967 base_expr_type_2>::type base_expr_type;
1970 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1971 expr1(expr1_), expr2(expr2_) {}
1975 int sz1 = expr1.size(), sz2 = expr2.size();
1976 return sz1 > sz2 ? sz1 : sz2;
1980 bool updateValue()
const {
1981 return expr1.updateValue() && expr2.updateValue();
1985 void cache()
const {
1988 const value_type_1 v1 = expr1.val();
1989 const value_type_2 v2 = expr2.val();
1990 max_v1 = (v1 >= v2);
1991 v = max_v1 ? v1 : v2;
1995 value_type
val()
const {
2000 bool isLinear()
const {
2005 bool hasFastAccess()
const {
2006 return expr1.hasFastAccess() && expr2.hasFastAccess();
2010 const value_type
dx(
int i)
const {
2011 return max_v1 ? expr1.dx(i) : expr2.dx(i);
2016 return max_v1 ? expr1.fastAccessDx(i) : expr2.fastAccessDx(i);
2021 const ExprT1& expr1;
2022 const ExprT2& expr2;
2023 mutable value_type v;
2024 mutable bool max_v1;
2028 template <
typename ExprT1,
typename T2>
2029 class Expr< MaxOp<ExprT1, ConstExpr<T2> > > {
2033 typedef ConstExpr<T2> ExprT2;
2034 typedef typename ExprT1::value_type value_type_1;
2035 typedef typename ExprT2::value_type value_type_2;
2037 value_type_2>::type value_type;
2039 typedef typename ExprT1::scalar_type scalar_type_1;
2040 typedef typename ExprT2::scalar_type scalar_type_2;
2042 scalar_type_2>::type scalar_type;
2044 typedef typename ExprT1::base_expr_type base_expr_type_1;
2045 typedef typename ExprT2::base_expr_type base_expr_type_2;
2047 base_expr_type_2>::type base_expr_type;
2050 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2051 expr1(expr1_), expr2(expr2_) {}
2055 return expr1.size();
2059 bool updateValue()
const {
2060 return expr1.updateValue();
2064 void cache()
const {
2066 const value_type_1 v1 = expr1.val();
2067 const value_type_2 v2 = expr2.val();
2068 max_v1 = (v1 >= v2);
2069 v = max_v1 ? v1 : v2;
2073 value_type
val()
const {
2078 bool isLinear()
const {
2083 bool hasFastAccess()
const {
2084 return expr1.hasFastAccess();
2088 const value_type
dx(
int i)
const {
2089 return max_v1 ? expr1.dx(i) : value_type(0);
2094 return max_v1 ? expr1.fastAccessDx(i) : value_type(0);
2099 const ExprT1& expr1;
2101 mutable value_type v;
2102 mutable bool max_v1;
2106 template <
typename T1,
typename ExprT2>
2107 class Expr< MaxOp< ConstExpr<T1>,ExprT2> > {
2111 typedef ConstExpr<T1> ExprT1;
2112 typedef typename ExprT1::value_type value_type_1;
2113 typedef typename ExprT2::value_type value_type_2;
2115 value_type_2>::type value_type;
2117 typedef typename ExprT1::scalar_type scalar_type_1;
2118 typedef typename ExprT2::scalar_type scalar_type_2;
2120 scalar_type_2>::type scalar_type;
2122 typedef typename ExprT1::base_expr_type base_expr_type_1;
2123 typedef typename ExprT2::base_expr_type base_expr_type_2;
2125 base_expr_type_2>::type base_expr_type;
2128 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2129 expr1(expr1_), expr2(expr2_) {}
2133 return expr2.size();
2137 bool updateValue()
const {
2138 return expr2.updateValue();
2142 void cache()
const {
2144 const value_type_1 v1 = expr1.val();
2145 const value_type_2 v2 = expr2.val();
2146 max_v1 = (v1 >= v2);
2147 v = max_v1 ? v1 : v2;
2151 value_type
val()
const {
2156 bool isLinear()
const {
2161 bool hasFastAccess()
const {
2162 return expr2.hasFastAccess();
2166 const value_type
dx(
int i)
const {
2167 return max_v1 ? value_type(0) : expr2.dx(i);
2172 return max_v1 ? value_type(0) : expr2.fastAccessDx(i);
2178 const ExprT2& expr2;
2179 mutable value_type v;
2180 mutable bool max_v1;
2188 template <
typename ExprT1,
typename ExprT2>
2191 template <
typename ExprT1,
typename ExprT2>
2192 class Expr< MinOp<ExprT1,ExprT2> > {
2196 typedef typename ExprT1::value_type value_type_1;
2197 typedef typename ExprT2::value_type value_type_2;
2199 value_type_2>::type value_type;
2201 typedef typename ExprT1::scalar_type scalar_type_1;
2202 typedef typename ExprT2::scalar_type scalar_type_2;
2204 scalar_type_2>::type scalar_type;
2206 typedef typename ExprT1::base_expr_type base_expr_type_1;
2207 typedef typename ExprT2::base_expr_type base_expr_type_2;
2209 base_expr_type_2>::type base_expr_type;
2212 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2213 expr1(expr1_), expr2(expr2_) {}
2217 int sz1 = expr1.size(), sz2 = expr2.size();
2218 return sz1 > sz2 ? sz1 : sz2;
2222 bool updateValue()
const {
2223 return expr1.updateValue() && expr2.updateValue();
2227 void cache()
const {
2230 const value_type_1 v1 = expr1.val();
2231 const value_type_2 v2 = expr2.val();
2232 min_v1 = (v1 <= v2);
2233 v = min_v1 ? v1 : v2;
2237 value_type
val()
const {
2242 bool isLinear()
const {
2247 bool hasFastAccess()
const {
2248 return expr1.hasFastAccess() && expr2.hasFastAccess();
2252 const value_type
dx(
int i)
const {
2253 return min_v1 ? expr1.dx(i) : expr2.dx(i);
2258 return min_v1 ? expr1.fastAccessDx(i) : expr2.fastAccessDx(i);
2263 const ExprT1& expr1;
2264 const ExprT2& expr2;
2265 mutable value_type v;
2266 mutable bool min_v1;
2270 template <
typename ExprT1,
typename T2>
2271 class Expr< MinOp<ExprT1, ConstExpr<T2> > > {
2275 typedef ConstExpr<T2> ExprT2;
2276 typedef typename ExprT1::value_type value_type_1;
2277 typedef typename ExprT2::value_type value_type_2;
2279 value_type_2>::type value_type;
2281 typedef typename ExprT1::scalar_type scalar_type_1;
2282 typedef typename ExprT2::scalar_type scalar_type_2;
2284 scalar_type_2>::type scalar_type;
2286 typedef typename ExprT1::base_expr_type base_expr_type_1;
2287 typedef typename ExprT2::base_expr_type base_expr_type_2;
2289 base_expr_type_2>::type base_expr_type;
2292 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2293 expr1(expr1_), expr2(expr2_) {}
2297 return expr1.size();
2301 bool updateValue()
const {
2302 return expr1.updateValue();
2306 void cache()
const {
2308 const value_type_1 v1 = expr1.val();
2309 const value_type_2 v2 = expr2.val();
2310 min_v1 = (v1 <= v2);
2311 v = min_v1 ? v1 : v2;
2315 value_type
val()
const {
2320 bool isLinear()
const {
2325 bool hasFastAccess()
const {
2326 return expr1.hasFastAccess();
2330 const value_type
dx(
int i)
const {
2331 return min_v1 ? expr1.dx(i) : value_type(0);
2336 return min_v1 ? expr1.fastAccessDx(i) : value_type(0);
2341 const ExprT1& expr1;
2343 mutable value_type v;
2344 mutable bool min_v1;
2348 template <
typename T1,
typename ExprT2>
2349 class Expr< MinOp< ConstExpr<T1>,ExprT2> > {
2353 typedef ConstExpr<T1> ExprT1;
2354 typedef typename ExprT1::value_type value_type_1;
2355 typedef typename ExprT2::value_type value_type_2;
2357 value_type_2>::type value_type;
2359 typedef typename ExprT1::scalar_type scalar_type_1;
2360 typedef typename ExprT2::scalar_type scalar_type_2;
2362 scalar_type_2>::type scalar_type;
2364 typedef typename ExprT1::base_expr_type base_expr_type_1;
2365 typedef typename ExprT2::base_expr_type base_expr_type_2;
2367 base_expr_type_2>::type base_expr_type;
2370 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2371 expr1(expr1_), expr2(expr2_) {}
2375 return expr2.size();
2379 bool updateValue()
const {
2380 return expr2.updateValue();
2384 void cache()
const {
2386 const value_type_1 v1 = expr1.val();
2387 const value_type_2 v2 = expr2.val();
2388 min_v1 = (v1 <= v2);
2389 v = min_v1 ? v1 : v2;
2393 value_type
val()
const {
2398 bool isLinear()
const {
2403 bool hasFastAccess()
const {
2404 return expr2.hasFastAccess();
2408 const value_type
dx(
int i)
const {
2409 return min_v1 ? value_type(0) : expr2.dx(i);
2414 return min_v1 ? value_type(0) : expr2.fastAccessDx(i);
2420 const ExprT2& expr2;
2421 mutable value_type v;
2422 mutable bool min_v1;
2430 #define FAD_BINARYOP_MACRO(OPNAME,OP) \
2431 namespace Sacado { \
2432 namespace CacheFad { \
2434 template <typename T1, typename T2> \
2435 KOKKOS_INLINE_FUNCTION \
2436 SACADO_FAD_OP_ENABLE_EXPR_EXPR(OP) \
2437 OPNAME (const T1& expr1, const T2& expr2) \
2439 typedef OP< T1, T2 > expr_t; \
2441 return Expr<expr_t>(expr1, expr2); \
2444 template <typename T> \
2445 KOKKOS_INLINE_FUNCTION \
2446 Expr< OP< Expr<T>, Expr<T> > > \
2447 OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
2449 typedef OP< Expr<T>, Expr<T> > expr_t; \
2451 return Expr<expr_t>(expr1, expr2); \
2454 template <typename T> \
2455 KOKKOS_INLINE_FUNCTION \
2456 Expr< OP< ConstExpr<typename Expr<T>::value_type>, \
2458 OPNAME (const typename Expr<T>::value_type& c, \
2459 const Expr<T>& expr) \
2461 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
2462 typedef OP< ConstT, Expr<T> > expr_t; \
2464 return Expr<expr_t>(ConstT(c), expr); \
2467 template <typename T> \
2468 KOKKOS_INLINE_FUNCTION \
2469 Expr< OP< Expr<T>, \
2470 ConstExpr<typename Expr<T>::value_type> > > \
2471 OPNAME (const Expr<T>& expr, \
2472 const typename Expr<T>::value_type& c) \
2474 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
2475 typedef OP< Expr<T>, ConstT > expr_t; \
2477 return Expr<expr_t>(expr, ConstT(c)); \
2480 template <typename T> \
2481 KOKKOS_INLINE_FUNCTION \
2482 SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
2483 OPNAME (const typename Expr<T>::scalar_type& c, \
2484 const Expr<T>& expr) \
2486 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
2487 typedef OP< ConstT, Expr<T> > expr_t; \
2489 return Expr<expr_t>(ConstT(c), expr); \
2492 template <typename T> \
2493 KOKKOS_INLINE_FUNCTION \
2494 SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
2495 OPNAME (const Expr<T>& expr, \
2496 const typename Expr<T>::scalar_type& c) \
2498 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
2499 typedef OP< Expr<T>, ConstT > expr_t; \
2501 return Expr<expr_t>(expr, ConstT(c)); \
2516 #undef FAD_BINARYOP_MACRO
2520 #define FAD_RELOP_MACRO(OP) \
2521 namespace Sacado { \
2522 namespace CacheFad { \
2523 template <typename ExprT1, typename ExprT2> \
2524 KOKKOS_INLINE_FUNCTION \
2526 operator OP (const Expr<ExprT1>& expr1, \
2527 const Expr<ExprT2>& expr2) \
2531 return expr1.val() OP expr2.val(); \
2534 template <typename ExprT2> \
2535 KOKKOS_INLINE_FUNCTION \
2537 operator OP (const typename Expr<ExprT2>::value_type& a, \
2538 const Expr<ExprT2>& expr2) \
2541 return a OP expr2.val(); \
2544 template <typename ExprT1> \
2545 KOKKOS_INLINE_FUNCTION \
2547 operator OP (const Expr<ExprT1>& expr1, \
2548 const typename Expr<ExprT1>::value_type& b) \
2551 return expr1.val() OP b; \
2567 #undef FAD_RELOP_MACRO
2571 namespace CacheFad {
2573 template <
typename ExprT>
2578 return ! expr.val();
2588 namespace CacheFad {
2590 template <
typename ExprT>
2594 bool is_zero = (x.val() == 0.0);
2595 for (
int i=0; i<x.size(); i++)
2596 is_zero = is_zero && (x.dx(i) == 0.0);
2604 #define FAD_BOOL_MACRO(OP) \
2605 namespace Sacado { \
2606 namespace CacheFad { \
2607 template <typename ExprT1, typename ExprT2> \
2608 KOKKOS_INLINE_FUNCTION \
2610 operator OP (const Expr<ExprT1>& expr1, \
2611 const Expr<ExprT2>& expr2) \
2613 return toBool(expr1) OP toBool(expr2); \
2616 template <typename ExprT2> \
2617 KOKKOS_INLINE_FUNCTION \
2619 operator OP (const typename Expr<ExprT2>::value_type& a, \
2620 const Expr<ExprT2>& expr2) \
2622 return a OP toBool(expr2); \
2625 template <typename ExprT1> \
2626 KOKKOS_INLINE_FUNCTION \
2628 operator OP (const Expr<ExprT1>& expr1, \
2629 const typename Expr<ExprT1>::value_type& b) \
2631 return toBool(expr1) OP b; \
2639 #undef FAD_BOOL_MACRO
2645 namespace CacheFad {
2647 template <
typename ExprT>
2648 std::ostream& operator << (std::ostream& os, const Expr<ExprT>& x) {
2650 os << x.val() <<
" [";
2652 for (
int i=0; i< x.size(); i++) {
2653 os <<
" " << x.dx(i);
2664 #endif // SACADO_CACHEFAD_OPS_HPP
KOKKOS_INLINE_FUNCTION Expr(const ExprT &expr_)
#define FAD_RELOP_MACRO(OP)
ExprT::scalar_type scalar_type
#define FAD_BINARYOP_MACRO(OPNAME, OP)
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
KOKKOS_INLINE_FUNCTION value_type val() const
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
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
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 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)
KOKKOS_INLINE_FUNCTION void cache() const
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
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
ExprT::value_type value_type
#define KOKKOS_INLINE_FUNCTION
ExprT::scalar_type scalar_type
KOKKOS_INLINE_FUNCTION bool isLinear() const
KOKKOS_INLINE_FUNCTION bool operator!(const Expr< ExprT > &expr)
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_)
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
expr expr expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 SubtractionOp
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