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();
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();
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 SACADO_INLINE_FUNCTION \
365 explicit Expr(const ExprT& expr_) : expr(expr_) {} \
367 SACADO_INLINE_FUNCTION \
368 int size() const { return expr.size(); } \
370 SACADO_INLINE_FUNCTION \
371 bool hasFastAccess() const { return expr.hasFastAccess(); } \
373 SACADO_INLINE_FUNCTION \
374 bool isPassive() const { return expr.isPassive();} \
376 SACADO_INLINE_FUNCTION \
377 bool updateValue() const { return expr.updateValue(); } \
379 SACADO_INLINE_FUNCTION \
380 void cache() const { \
386 SACADO_INLINE_FUNCTION \
387 value_type val() const { \
391 SACADO_INLINE_FUNCTION \
392 value_type dx(int i) const { \
393 return expr.dx(i)*a; \
396 SACADO_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 SACADO_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)),
507 template <typename ExprT1, typename ExprT2>
510 template <
typename ExprT1,
typename 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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);
1482 v = std::atan2(v1,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);
1566 v = std::atan2(v1,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);
1644 v = std::atan2(v1,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();
1729 v = std::pow(v1,v2);
1730 if (expr2.size() == 0 && v2 == value_type(1)) {
1734 else if (v1 == value_type(0)) {
1745 value_type
val()
const {
1750 bool isLinear()
const {
1755 bool hasFastAccess()
const {
1756 return expr1.hasFastAccess() && expr2.hasFastAccess();
1760 const value_type
dx(
int i)
const {
1761 if (expr1.size() > 0 && expr2.size() > 0)
1762 return expr1.dx(
i)*
a + expr2.dx(
i)*b;
1763 else if (expr1.size() > 0)
1764 return expr1.dx(
i)*
a;
1766 return expr1.val()*b;
1771 return expr1.fastAccessDx(
i)*
a + expr2.fastAccessDx(
i)*b;
1776 const ExprT1& expr1;
1777 const ExprT2& expr2;
1778 mutable value_type v;
1779 mutable value_type
a;
1780 mutable value_type b;
1784 template <
typename ExprT1,
typename T2>
1785 class Expr<
PowerOp<ExprT1, ConstExpr<
T2> > > {
1789 typedef ConstExpr<T2> ExprT2;
1790 typedef typename ExprT1::value_type value_type_1;
1791 typedef typename ExprT2::value_type value_type_2;
1793 value_type_2>::type value_type;
1795 typedef typename ExprT1::scalar_type scalar_type_1;
1796 typedef typename ExprT2::scalar_type scalar_type_2;
1798 scalar_type_2>::type scalar_type;
1800 typedef typename ExprT1::base_expr_type base_expr_type_1;
1801 typedef typename ExprT2::base_expr_type base_expr_type_2;
1803 base_expr_type_2>::type base_expr_type;
1806 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1807 expr1(expr1_), expr2(expr2_) {}
1811 return expr1.size();
1815 bool updateValue()
const {
1816 return expr1.updateValue();
1820 void cache()
const {
1822 const value_type_1 v1 = expr1.val();
1823 const value_type_2 v2 = expr2.val();
1824 v = std::pow(v1,v2);
1825 if (v2 == value_type_1(1)) {
1828 else if (v1 == value_type_1(0)) {
1837 value_type
val()
const {
1842 bool isLinear()
const {
1847 bool hasFastAccess()
const {
1848 return expr1.hasFastAccess();
1852 const value_type
dx(
int i)
const {
1853 return expr1.dx(
i)*
a;
1858 return expr1.fastAccessDx(
i)*
a;
1863 const ExprT1& expr1;
1865 mutable value_type v;
1866 mutable value_type
a;
1870 template <
typename T1,
typename ExprT2>
1871 class Expr<
PowerOp< ConstExpr<
T1>,ExprT2> > {
1875 typedef ConstExpr<T1> ExprT1;
1876 typedef typename ExprT1::value_type value_type_1;
1877 typedef typename ExprT2::value_type value_type_2;
1879 value_type_2>::type value_type;
1881 typedef typename ExprT1::scalar_type scalar_type_1;
1882 typedef typename ExprT2::scalar_type scalar_type_2;
1884 scalar_type_2>::type scalar_type;
1886 typedef typename ExprT1::base_expr_type base_expr_type_1;
1887 typedef typename ExprT2::base_expr_type base_expr_type_2;
1889 base_expr_type_2>::type base_expr_type;
1892 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1893 expr1(expr1_), expr2(expr2_) {}
1897 return expr2.size();
1901 bool updateValue()
const {
1902 return expr2.updateValue();
1906 void cache()
const {
1908 const value_type_1 v1 = expr1.val();
1909 const value_type_2 v2 = expr2.val();
1910 v = std::pow(v1,v2);
1911 if (v1 == value_type(0)) {
1920 value_type
val()
const {
1925 bool isLinear()
const {
1930 bool hasFastAccess()
const {
1931 return expr2.hasFastAccess();
1935 const value_type
dx(
int i)
const {
1936 return expr2.dx(
i)*b;
1941 return expr2.fastAccessDx(
i)*b;
1947 const ExprT2& expr2;
1948 mutable value_type v;
1949 mutable value_type b;
1957 template <
typename ExprT1,
typename ExprT2>
1960 template <
typename ExprT1,
typename ExprT2>
1961 class Expr<
MaxOp<ExprT1,ExprT2> > {
1965 typedef typename ExprT1::value_type value_type_1;
1966 typedef typename ExprT2::value_type value_type_2;
1968 value_type_2>::type value_type;
1970 typedef typename ExprT1::scalar_type scalar_type_1;
1971 typedef typename ExprT2::scalar_type scalar_type_2;
1973 scalar_type_2>::type scalar_type;
1975 typedef typename ExprT1::base_expr_type base_expr_type_1;
1976 typedef typename ExprT2::base_expr_type base_expr_type_2;
1978 base_expr_type_2>::type base_expr_type;
1981 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
1982 expr1(expr1_), expr2(expr2_) {}
1986 int sz1 = expr1.size(), sz2 = expr2.size();
1987 return sz1 > sz2 ? sz1 : sz2;
1991 bool updateValue()
const {
1992 return expr1.updateValue() && expr2.updateValue();
1996 void cache()
const {
1999 const value_type_1 v1 = expr1.val();
2000 const value_type_2 v2 = expr2.val();
2001 max_v1 = (v1 >= v2);
2002 v = max_v1 ? v1 : v2;
2006 value_type
val()
const {
2011 bool isLinear()
const {
2016 bool hasFastAccess()
const {
2017 return expr1.hasFastAccess() && expr2.hasFastAccess();
2021 const value_type
dx(
int i)
const {
2022 return max_v1 ? expr1.dx(
i) : expr2.dx(
i);
2027 return max_v1 ? expr1.fastAccessDx(
i) : expr2.fastAccessDx(
i);
2032 const ExprT1& expr1;
2033 const ExprT2& expr2;
2034 mutable value_type v;
2035 mutable bool max_v1;
2039 template <
typename ExprT1,
typename T2>
2040 class Expr<
MaxOp<ExprT1, ConstExpr<
T2> > > {
2044 typedef ConstExpr<T2> ExprT2;
2045 typedef typename ExprT1::value_type value_type_1;
2046 typedef typename ExprT2::value_type value_type_2;
2048 value_type_2>::type value_type;
2050 typedef typename ExprT1::scalar_type scalar_type_1;
2051 typedef typename ExprT2::scalar_type scalar_type_2;
2053 scalar_type_2>::type scalar_type;
2055 typedef typename ExprT1::base_expr_type base_expr_type_1;
2056 typedef typename ExprT2::base_expr_type base_expr_type_2;
2058 base_expr_type_2>::type base_expr_type;
2061 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2062 expr1(expr1_), expr2(expr2_) {}
2066 return expr1.size();
2070 bool updateValue()
const {
2071 return expr1.updateValue();
2075 void cache()
const {
2077 const value_type_1 v1 = expr1.val();
2078 const value_type_2 v2 = expr2.val();
2079 max_v1 = (v1 >= v2);
2080 v = max_v1 ? v1 : v2;
2084 value_type
val()
const {
2089 bool isLinear()
const {
2094 bool hasFastAccess()
const {
2095 return expr1.hasFastAccess();
2099 const value_type
dx(
int i)
const {
2100 return max_v1 ? expr1.dx(
i) : value_type(0);
2105 return max_v1 ? expr1.fastAccessDx(
i) : value_type(0);
2110 const ExprT1& expr1;
2112 mutable value_type v;
2113 mutable bool max_v1;
2117 template <
typename T1,
typename ExprT2>
2118 class Expr<
MaxOp< ConstExpr<
T1>,ExprT2> > {
2122 typedef ConstExpr<T1> ExprT1;
2123 typedef typename ExprT1::value_type value_type_1;
2124 typedef typename ExprT2::value_type value_type_2;
2126 value_type_2>::type value_type;
2128 typedef typename ExprT1::scalar_type scalar_type_1;
2129 typedef typename ExprT2::scalar_type scalar_type_2;
2131 scalar_type_2>::type scalar_type;
2133 typedef typename ExprT1::base_expr_type base_expr_type_1;
2134 typedef typename ExprT2::base_expr_type base_expr_type_2;
2136 base_expr_type_2>::type base_expr_type;
2139 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2140 expr1(expr1_), expr2(expr2_) {}
2144 return expr2.size();
2148 bool updateValue()
const {
2149 return expr2.updateValue();
2153 void cache()
const {
2155 const value_type_1 v1 = expr1.val();
2156 const value_type_2 v2 = expr2.val();
2157 max_v1 = (v1 >= v2);
2158 v = max_v1 ? v1 : v2;
2162 value_type
val()
const {
2167 bool isLinear()
const {
2172 bool hasFastAccess()
const {
2173 return expr2.hasFastAccess();
2177 const value_type
dx(
int i)
const {
2178 return max_v1 ? value_type(0) : expr2.
dx(
i);
2189 const ExprT2& expr2;
2190 mutable value_type v;
2191 mutable bool max_v1;
2199 template <
typename ExprT1,
typename ExprT2>
2202 template <
typename ExprT1,
typename ExprT2>
2203 class Expr<
MinOp<ExprT1,ExprT2> > {
2207 typedef typename ExprT1::value_type value_type_1;
2208 typedef typename ExprT2::value_type value_type_2;
2210 value_type_2>::type value_type;
2212 typedef typename ExprT1::scalar_type scalar_type_1;
2213 typedef typename ExprT2::scalar_type scalar_type_2;
2215 scalar_type_2>::type scalar_type;
2217 typedef typename ExprT1::base_expr_type base_expr_type_1;
2218 typedef typename ExprT2::base_expr_type base_expr_type_2;
2220 base_expr_type_2>::type base_expr_type;
2223 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2224 expr1(expr1_), expr2(expr2_) {}
2228 int sz1 = expr1.size(), sz2 = expr2.size();
2229 return sz1 > sz2 ? sz1 : sz2;
2233 bool updateValue()
const {
2234 return expr1.updateValue() && expr2.updateValue();
2238 void cache()
const {
2241 const value_type_1 v1 = expr1.val();
2242 const value_type_2 v2 = expr2.val();
2243 min_v1 = (v1 <= v2);
2244 v = min_v1 ? v1 : v2;
2248 value_type
val()
const {
2253 bool isLinear()
const {
2258 bool hasFastAccess()
const {
2259 return expr1.hasFastAccess() && expr2.hasFastAccess();
2263 const value_type
dx(
int i)
const {
2264 return min_v1 ? expr1.dx(
i) : expr2.dx(
i);
2269 return min_v1 ? expr1.fastAccessDx(
i) : expr2.fastAccessDx(
i);
2274 const ExprT1& expr1;
2275 const ExprT2& expr2;
2276 mutable value_type v;
2277 mutable bool min_v1;
2281 template <
typename ExprT1,
typename T2>
2282 class Expr<
MinOp<ExprT1, ConstExpr<
T2> > > {
2286 typedef ConstExpr<T2> ExprT2;
2287 typedef typename ExprT1::value_type value_type_1;
2288 typedef typename ExprT2::value_type value_type_2;
2290 value_type_2>::type value_type;
2292 typedef typename ExprT1::scalar_type scalar_type_1;
2293 typedef typename ExprT2::scalar_type scalar_type_2;
2295 scalar_type_2>::type scalar_type;
2297 typedef typename ExprT1::base_expr_type base_expr_type_1;
2298 typedef typename ExprT2::base_expr_type base_expr_type_2;
2300 base_expr_type_2>::type base_expr_type;
2303 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2304 expr1(expr1_), expr2(expr2_) {}
2308 return expr1.size();
2312 bool updateValue()
const {
2313 return expr1.updateValue();
2317 void cache()
const {
2319 const value_type_1 v1 = expr1.val();
2320 const value_type_2 v2 = expr2.val();
2321 min_v1 = (v1 <= v2);
2322 v = min_v1 ? v1 : v2;
2326 value_type
val()
const {
2331 bool isLinear()
const {
2336 bool hasFastAccess()
const {
2337 return expr1.hasFastAccess();
2341 const value_type
dx(
int i)
const {
2342 return min_v1 ? expr1.dx(
i) : value_type(0);
2347 return min_v1 ? expr1.fastAccessDx(
i) : value_type(0);
2352 const ExprT1& expr1;
2354 mutable value_type v;
2355 mutable bool min_v1;
2359 template <
typename T1,
typename ExprT2>
2360 class Expr<
MinOp< ConstExpr<
T1>,ExprT2> > {
2364 typedef ConstExpr<T1> ExprT1;
2365 typedef typename ExprT1::value_type value_type_1;
2366 typedef typename ExprT2::value_type value_type_2;
2368 value_type_2>::type value_type;
2370 typedef typename ExprT1::scalar_type scalar_type_1;
2371 typedef typename ExprT2::scalar_type scalar_type_2;
2373 scalar_type_2>::type scalar_type;
2375 typedef typename ExprT1::base_expr_type base_expr_type_1;
2376 typedef typename ExprT2::base_expr_type base_expr_type_2;
2378 base_expr_type_2>::type base_expr_type;
2381 Expr(
const ExprT1& expr1_,
const ExprT2& expr2_) :
2382 expr1(expr1_), expr2(expr2_) {}
2386 return expr2.size();
2390 bool updateValue()
const {
2391 return expr2.updateValue();
2395 void cache()
const {
2397 const value_type_1 v1 = expr1.val();
2398 const value_type_2 v2 = expr2.val();
2399 min_v1 = (v1 <= v2);
2400 v = min_v1 ? v1 : v2;
2404 value_type
val()
const {
2409 bool isLinear()
const {
2414 bool hasFastAccess()
const {
2415 return expr2.hasFastAccess();
2419 const value_type
dx(
int i)
const {
2420 return min_v1 ? value_type(0) : expr2.
dx(
i);
2431 const ExprT2& expr2;
2432 mutable value_type v;
2433 mutable bool min_v1;
2441#define FAD_BINARYOP_MACRO(OPNAME,OP) \
2443 namespace CacheFad { \
2445 template <typename T1, typename T2> \
2446 SACADO_INLINE_FUNCTION \
2447 SACADO_FAD_OP_ENABLE_EXPR_EXPR(OP) \
2448 OPNAME (const T1& expr1, const T2& expr2) \
2450 typedef OP< T1, T2 > expr_t; \
2452 return Expr<expr_t>(expr1, expr2); \
2455 template <typename T> \
2456 SACADO_INLINE_FUNCTION \
2457 Expr< OP< Expr<T>, Expr<T> > > \
2458 OPNAME (const Expr<T>& expr1, const Expr<T>& expr2) \
2460 typedef OP< Expr<T>, Expr<T> > expr_t; \
2462 return Expr<expr_t>(expr1, expr2); \
2465 template <typename T> \
2466 SACADO_INLINE_FUNCTION \
2467 Expr< OP< ConstExpr<typename Expr<T>::value_type>, \
2469 OPNAME (const typename Expr<T>::value_type& c, \
2470 const Expr<T>& expr) \
2472 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
2473 typedef OP< ConstT, Expr<T> > expr_t; \
2475 return Expr<expr_t>(ConstT(c), expr); \
2478 template <typename T> \
2479 SACADO_INLINE_FUNCTION \
2480 Expr< OP< Expr<T>, \
2481 ConstExpr<typename Expr<T>::value_type> > > \
2482 OPNAME (const Expr<T>& expr, \
2483 const typename Expr<T>::value_type& c) \
2485 typedef ConstExpr<typename Expr<T>::value_type> ConstT; \
2486 typedef OP< Expr<T>, ConstT > expr_t; \
2488 return Expr<expr_t>(expr, ConstT(c)); \
2491 template <typename T> \
2492 SACADO_INLINE_FUNCTION \
2493 SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
2494 OPNAME (const typename Expr<T>::scalar_type& c, \
2495 const Expr<T>& expr) \
2497 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
2498 typedef OP< ConstT, Expr<T> > expr_t; \
2500 return Expr<expr_t>(ConstT(c), expr); \
2503 template <typename T> \
2504 SACADO_INLINE_FUNCTION \
2505 SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
2506 OPNAME (const Expr<T>& expr, \
2507 const typename Expr<T>::scalar_type& c) \
2509 typedef ConstExpr<typename Expr<T>::scalar_type> ConstT; \
2510 typedef OP< Expr<T>, ConstT > expr_t; \
2512 return Expr<expr_t>(expr, ConstT(c)); \
2527#undef FAD_BINARYOP_MACRO
2531#define FAD_RELOP_MACRO(OP) \
2533 namespace CacheFad { \
2534 template <typename ExprT1, typename ExprT2> \
2535 SACADO_INLINE_FUNCTION \
2537 operator OP (const Expr<ExprT1>& expr1, \
2538 const Expr<ExprT2>& expr2) \
2542 return expr1.val() OP expr2.val(); \
2545 template <typename ExprT2> \
2546 SACADO_INLINE_FUNCTION \
2548 operator OP (const typename Expr<ExprT2>::value_type& a, \
2549 const Expr<ExprT2>& expr2) \
2552 return a OP expr2.val(); \
2555 template <typename ExprT1> \
2556 SACADO_INLINE_FUNCTION \
2558 operator OP (const Expr<ExprT1>& expr1, \
2559 const typename Expr<ExprT1>::value_type& b) \
2562 return expr1.val() OP b; \
2578#undef FAD_RELOP_MACRO
2582 namespace CacheFad {
2584 template <
typename ExprT>
2589 return ! expr.val();
2599 namespace CacheFad {
2601 template <
typename ExprT>
2605 bool is_zero = (
x.val() == 0.0);
2606 for (
int i=0;
i<
x.size();
i++)
2607 is_zero = is_zero && (
x.dx(
i) == 0.0);
2615#define FAD_BOOL_MACRO(OP) \
2617 namespace CacheFad { \
2618 template <typename ExprT1, typename ExprT2> \
2619 SACADO_INLINE_FUNCTION \
2621 operator OP (const Expr<ExprT1>& expr1, \
2622 const Expr<ExprT2>& expr2) \
2624 return toBool(expr1) OP toBool(expr2); \
2627 template <typename ExprT2> \
2628 SACADO_INLINE_FUNCTION \
2630 operator OP (const typename Expr<ExprT2>::value_type& a, \
2631 const Expr<ExprT2>& expr2) \
2633 return a OP toBool(expr2); \
2636 template <typename ExprT1> \
2637 SACADO_INLINE_FUNCTION \
2639 operator OP (const Expr<ExprT1>& expr1, \
2640 const typename Expr<ExprT1>::value_type& b) \
2642 return toBool(expr1) OP b; \
2650#undef FAD_BOOL_MACRO
2656 namespace CacheFad {
2658 template <
typename ExprT>
2661 os <<
x.val() <<
" [";
2663 for (
int i=0;
i<
x.size();
i++) {
2664 os <<
" " <<
x.dx(
i);
#define FAD_BINARYOP_MACRO(OPNAME, OP)
#define FAD_RELOP_MACRO(OP)
#define FAD_BOOL_MACRO(OP)
#define FAD_UNARYOP_MACRO(OPNAME, OP, PARTIAL, VALUE)
#define SACADO_INLINE_FUNCTION
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
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
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
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
expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 MultiplicationOp
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 PowerOp
SACADO_INLINE_FUNCTION void cache() const
ExprT::base_expr_type base_expr_type
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION value_type val() const
ExprT::value_type value_type
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION Expr(const ExprT &expr_)
SACADO_INLINE_FUNCTION bool hasFastAccess() const
ExprT::scalar_type scalar_type
SACADO_INLINE_FUNCTION bool isLinear() const
ExprT::base_expr_type base_expr_type
SACADO_INLINE_FUNCTION value_type val() const
SACADO_INLINE_FUNCTION int size() const
ExprT::value_type value_type
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool updateValue() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT::scalar_type scalar_type
SACADO_INLINE_FUNCTION bool isLinear() const
SACADO_INLINE_FUNCTION Expr(const ExprT &expr_)
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT::value_type value_type
ExprT::scalar_type scalar_type
SACADO_INLINE_FUNCTION bool isLinear() const
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION Expr(const ExprT &expr_)
SACADO_INLINE_FUNCTION value_type val() const
SACADO_INLINE_FUNCTION const value_type dx(int i) const
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
SACADO_INLINE_FUNCTION bool updateValue() const
ExprT::base_expr_type base_expr_type
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION int size() const
ExprT::scalar_type scalar_type
SACADO_INLINE_FUNCTION const value_type fastAccessDx(int i) const
ExprT::value_type value_type
SACADO_INLINE_FUNCTION const value_type dx(int i) const
ExprT::base_expr_type base_expr_type
SACADO_INLINE_FUNCTION bool hasFastAccess() const
SACADO_INLINE_FUNCTION Expr(const ExprT &expr_)
SACADO_INLINE_FUNCTION bool isLinear() const
SACADO_INLINE_FUNCTION value_type val() const
SACADO_INLINE_FUNCTION int size() const
SACADO_INLINE_FUNCTION void cache() const
SACADO_INLINE_FUNCTION bool updateValue() const
Wrapper for a generic expression template.
SACADO_INLINE_FUNCTION bool operator!(const Expr< ExprT > &expr)
SACADO_INLINE_FUNCTION bool toBool(const Expr< ExprT > &x)
SACADO_INLINE_FUNCTION Expr< UnaryPlusOp< Expr< T > > > operator+(const Expr< T > &expr)
SACADO_INLINE_FUNCTION Expr< AbsOp< Expr< T > > > abs(const Expr< T > &expr)
std::ostream & operator<<(std::ostream &os, const Expr< ExprT > &x)
SACADO_INLINE_FUNCTION Expr< FAbsOp< Expr< T > > > fabs(const Expr< T > &expr)
SACADO_INLINE_FUNCTION Expr< UnaryMinusOp< Expr< T > > > operator-(const Expr< T > &expr)