1032 if_then_else( expr1.val(
j) <= c.fastAccessCoeff(
j), expr1.fastAccessDx(i,
j), val_type(0) ) )
1045 template <
typename T1,
typename T2>
1046 class PowerOp< T1, T2, false, false, ExprSpecMPVector, PowerImpl::Simd > :
1047 public Expr< PowerOp< T1, T2, false, false, ExprSpecMPVector,
1048 PowerImpl::Simd > > {
1051 typedef typename std::remove_cv<T1>::type ExprT1;
1052 typedef typename std::remove_cv<T2>::type ExprT2;
1053 typedef typename ExprT1::value_type value_type_1;
1054 typedef typename ExprT2::value_type value_type_2;
1055 typedef typename Sacado::Promote<value_type_1,
1056 value_type_2>::type value_type;
1058 typedef typename ExprT1::scalar_type scalar_type_1;
1059 typedef typename ExprT2::scalar_type scalar_type_2;
1060 typedef typename Sacado::Promote<scalar_type_1,
1061 scalar_type_2>::type scalar_type;
1063 typedef typename value_type::value_type val_type;
1065 typedef ExprSpecMPVector expr_spec_type;
1067 KOKKOS_INLINE_FUNCTION
1068 PowerOp(
const T1& expr1_,
const T2& expr2_) :
1069 expr1(expr1_), expr2(expr2_) {}
1071 KOKKOS_INLINE_FUNCTION
1073 const int sz1 = expr1.size(), sz2 = expr2.size();
1074 return sz1 > sz2 ? sz1 : sz2;
1077 KOKKOS_INLINE_FUNCTION
1078 bool hasFastAccess()
const {
1079 return expr1.hasFastAccess() && expr2.hasFastAccess();
1082 KOKKOS_INLINE_FUNCTION
1083 value_type
val()
const {
1085 return pow(expr1.val(), expr2.val());
1088 KOKKOS_INLINE_FUNCTION
1089 val_type
val(
int j)
const {
1091 return pow(expr1.val(
j), expr2.val(
j));
1094 KOKKOS_INLINE_FUNCTION
1095 val_type
dx(
int i,
int j)
const {
1096 using std::pow;
using std::log;
1097 const int sz1 = expr1.size(), sz2 = expr2.size();
1098 if (sz1 > 0 && sz2 > 0)
1099 return if_then_else( expr1.val(
j) == val_type(0.0), val_type(0.0), val_type((expr2.dx(i,
j)*log(expr1.val(
j))+expr2.val(
j)*expr1.dx(i,
j)/expr1.val(
j))*pow(expr1.val(
j),expr2.val(
j))) );
1103 return if_then_else( expr2.val(
j) == scalar_type(1.0), expr1.dx(i,
j),
if_then_else( expr1.val(
j) == val_type(0.0), val_type(0.0), val_type(expr2.val(
j)*expr1.dx(i,
j)/expr1.val(
j)*pow(expr1.val(
j),expr2.val(
j))) ));
1105 return if_then_else( expr1.val(
j) == val_type(0.0), val_type(0.0), val_type(expr2.dx(i,
j)*log(expr1.val(
j))*pow(expr1.val(
j),expr2.val(
j))) );
1108 KOKKOS_INLINE_FUNCTION
1110 using std::pow;
using std::log;
1111 return if_then_else( expr1.val(
j) == val_type(0.0), val_type(0.0), val_type((expr2.fastAccessDx(i,
j)*log(expr1.val(
j))+expr2.val(
j)*expr1.fastAccessDx(i,
j)/expr1.val(
j))*pow(expr1.val(
j),expr2.val(
j))) );
1121 template <
typename T1,
typename T2>
1122 class PowerOp< T1, T2, false,
true, ExprSpecMPVector, PowerImpl::Simd >
1123 :
public Expr< PowerOp< T1, T2, false, true, ExprSpecMPVector,
1124 PowerImpl::Simd > > {
1127 typedef typename std::remove_cv<T1>::type ExprT1;
1129 typedef typename ExprT1::value_type value_type;
1130 typedef typename ExprT1::scalar_type scalar_type;
1132 typedef typename value_type::value_type val_type;
1134 typedef ExprSpecMPVector expr_spec_type;
1136 KOKKOS_INLINE_FUNCTION
1137 PowerOp(
const T1& expr1_,
const ConstT& c_) :
1138 expr1(expr1_), c(c_) {}
1140 KOKKOS_INLINE_FUNCTION
1142 return expr1.size();
1145 KOKKOS_INLINE_FUNCTION
1146 bool hasFastAccess()
const {
1147 return expr1.hasFastAccess();
1150 KOKKOS_INLINE_FUNCTION
1151 value_type
val()
const {
1153 return pow(expr1.val(), c);
1156 KOKKOS_INLINE_FUNCTION
1157 val_type
val(
int j)
const {
1159 return pow(expr1.val(
j), c.fastAccessCoeff(
j));
1162 KOKKOS_INLINE_FUNCTION
1163 val_type
dx(
int i,
int j)
const {
1167 return if_then_else( c.fastAccessCoeff(
j) == scalar_type(1.0), expr1.dx(i,
j),
if_then_else( expr1.val(
j) == val_type(0.0), val_type(0.0), val_type(c.fastAccessCoeff(
j)*expr1.dx(i,
j)/expr1.val(
j)*pow(expr1.val(
j),c.fastAccessCoeff(
j))) ));
1170 KOKKOS_INLINE_FUNCTION
1175 return if_then_else( c.fastAccessCoeff(
j) == scalar_type(1.0), expr1.fastAccessDx(i,
j),
if_then_else( expr1.val(
j) == val_type(0.0), val_type(0.0), val_type(c.fastAccessCoeff(
j)*expr1.fastAccessDx(i,
j)/expr1.val(
j)*pow(expr1.val(
j),c.fastAccessCoeff(
j))) ));
1184 template <
typename T1,
typename T2>
1185 class PowerOp< T1, T2,
true, false, ExprSpecMPVector, PowerImpl::Simd >
1186 :
public Expr< PowerOp< T1, T2, true, false, ExprSpecMPVector,
1187 PowerImpl::Simd> > {
1190 typedef typename std::remove_cv<T2>::type ExprT2;
1192 typedef typename ExprT2::value_type value_type;
1193 typedef typename ExprT2::scalar_type scalar_type;
1195 typedef typename value_type::value_type val_type;
1197 typedef ExprSpecMPVector expr_spec_type;
1199 KOKKOS_INLINE_FUNCTION
1200 PowerOp(
const ConstT& c_,
const T2& expr2_) :
1201 c(c_), expr2(expr2_) {}
1203 KOKKOS_INLINE_FUNCTION
1205 return expr2.size();
1208 KOKKOS_INLINE_FUNCTION
1209 bool hasFastAccess()
const {
1210 return expr2.hasFastAccess();
1213 KOKKOS_INLINE_FUNCTION
1214 value_type
val()
const {
1216 return pow(c, expr2.val());
1219 KOKKOS_INLINE_FUNCTION
1220 val_type
val(
int j)
const {
1222 return pow(c.fastAccessCoeff(
j), expr2.val(
j));
1225 KOKKOS_INLINE_FUNCTION
1226 val_type
dx(
int i,
int j)
const {
1227 using std::pow;
using std::log;
1228 return if_then_else( c.fastAccessCoeff(
j) == val_type(0.0), val_type(0.0), val_type(expr2.dx(i,
j)*log(c.fastAccessCoeff(
j))*pow(c.fastAccessCoeff(
j),expr2.val(
j))) );
1231 KOKKOS_INLINE_FUNCTION
1233 using std::pow;
using std::log;
1234 return if_then_else( c.fastAccessCoeff(
j) == val_type(0.0), val_type(0.0), val_type(expr2.fastAccessDx(i,
j)*log(c.fastAccessCoeff(
j))*pow(c.fastAccessCoeff(
j),expr2.val(
j))) );
1248 template <
typename T1,
typename T2>
1249 class PowerOp< T1, T2, false, false, ExprSpecMPVector,
1250 PowerImpl::NestedSimd > :
1251 public Expr< PowerOp< T1, T2, false, false, ExprSpecMPVector,
1252 PowerImpl::NestedSimd > > {
1255 typedef typename std::remove_cv<T1>::type ExprT1;
1256 typedef typename std::remove_cv<T2>::type ExprT2;
1257 typedef typename ExprT1::value_type value_type_1;
1258 typedef typename ExprT2::value_type value_type_2;
1259 typedef typename Sacado::Promote<value_type_1,
1260 value_type_2>::type value_type;
1262 typedef typename ExprT1::scalar_type scalar_type_1;
1263 typedef typename ExprT2::scalar_type scalar_type_2;
1264 typedef typename Sacado::Promote<scalar_type_1,
1265 scalar_type_2>::type scalar_type;
1267 typedef typename value_type::value_type val_type;
1269 typedef ExprSpecMPVector expr_spec_type;
1271 KOKKOS_INLINE_FUNCTION
1272 PowerOp(
const T1& expr1_,
const T2& expr2_) :
1273 expr1(expr1_), expr2(expr2_) {}
1275 KOKKOS_INLINE_FUNCTION
1277 const int sz1 = expr1.size(), sz2 = expr2.size();
1278 return sz1 > sz2 ? sz1 : sz2;
1281 KOKKOS_INLINE_FUNCTION
1282 bool hasFastAccess()
const {
1283 return expr1.hasFastAccess() && expr2.hasFastAccess();
1286 KOKKOS_INLINE_FUNCTION
1287 value_type
val()
const {
1289 return pow(expr1.val(), expr2.val());
1292 KOKKOS_INLINE_FUNCTION
1293 val_type
val(
int j)
const {
1295 return pow(expr1.val(
j), expr2.val(
j));
1298 KOKKOS_INLINE_FUNCTION
1299 value_type
dx(
int i,
int j)
const {
1300 using std::pow;
using std::log;
1301 const int sz1 = expr1.size(), sz2 = expr2.size();
1302 if (sz1 > 0 && sz2 > 0)
1303 return (expr2.dx(i,
j)*log(expr1.val(
j))+expr2.val(
j)*expr1.dx(i,
j)/expr1.val(
j))*pow(expr1.val(
j),expr2.val(
j));
1305 return if_then_else( expr2.val(
j) == scalar_type(0.0), value_type(0.0), value_type((expr2.val(
j)*expr1.dx(i,
j))*pow(expr1.val(
j),expr2.val(
j)-scalar_type(1.0))));
1307 return expr2.dx(i,
j)*log(expr1.val(
j))*pow(expr1.val(
j),expr2.val(
j));
1310 KOKKOS_INLINE_FUNCTION
1312 using std::pow;
using std::log;
1313 return (expr2.fastAccessDx(i,
j)*log(expr1.val(
j))+expr2.val(
j)*expr1.fastAccessDx(i,
j)/expr1.val(
j))*pow(expr1.val(
j),expr2.val(
j));
1323 template <
typename T1,
typename T2>
1324 class PowerOp< T1, T2, false,
true, ExprSpecMPVector,
1325 PowerImpl::NestedSimd > :
1326 public Expr< PowerOp< T1, T2, false, true, ExprSpecMPVector,
1327 PowerImpl::NestedSimd > > {
1330 typedef typename std::remove_cv<T1>::type ExprT1;
1332 typedef typename ExprT1::value_type value_type;
1333 typedef typename ExprT1::scalar_type scalar_type;
1335 typedef typename value_type::value_type val_type;
1337 typedef ExprSpecMPVector expr_spec_type;
1339 KOKKOS_INLINE_FUNCTION
1340 PowerOp(
const T1& expr1_,
const ConstT& c_) :
1341 expr1(expr1_), c(c_) {}
1343 KOKKOS_INLINE_FUNCTION
1345 return expr1.size();
1348 KOKKOS_INLINE_FUNCTION
1349 bool hasFastAccess()
const {
1350 return expr1.hasFastAccess();
1353 KOKKOS_INLINE_FUNCTION
1354 value_type
val()
const {
1356 return pow(expr1.val(), c);
1359 KOKKOS_INLINE_FUNCTION
1360 val_type
val(
int j)
const {
1362 return pow(expr1.val(
j), c.fastAccessCoeff(
j));
1365 KOKKOS_INLINE_FUNCTION
1366 value_type
dx(
int i,
int j)
const {
1368 return if_then_else( c.fastAccessCoeff(
j) == scalar_type(0.0), value_type(0.0), value_type(c.fastAccessCoeff(
j)*expr1.dx(i,
j)*pow(expr1.val(
j),c.fastAccessCoeff(
j)-scalar_type(1.0))));
1371 KOKKOS_INLINE_FUNCTION
1374 return if_then_else( c.fastAccessCoeff(
j) == scalar_type(0.0), value_type(0.0), value_type(c.fastAccessCoeff(
j)*expr1.fastAccessDx(i,
j)*pow(expr1.val(
j),c.fastAccessCoeff(
j)-scalar_type(1.0))));
1383 template <
typename T1,
typename T2>
1384 class PowerOp<T1, T2,
true, false, ExprSpecMPVector,
1385 PowerImpl::NestedSimd > :
1386 public Expr< PowerOp< T1, T2, true, false, ExprSpecMPVector,
1387 PowerImpl::NestedSimd > > {
1390 typedef typename std::remove_cv<T2>::type ExprT2;
1392 typedef typename ExprT2::value_type value_type;
1393 typedef typename ExprT2::scalar_type scalar_type;
1395 typedef typename value_type::value_type val_type;
1397 typedef ExprSpecMPVector expr_spec_type;
1399 KOKKOS_INLINE_FUNCTION
1400 PowerOp(
const ConstT& c_,
const T2& expr2_) :
1401 c(c_), expr2(expr2_) {}
1403 KOKKOS_INLINE_FUNCTION
1405 return expr2.size();
1408 KOKKOS_INLINE_FUNCTION
1409 bool hasFastAccess()
const {
1410 return expr2.hasFastAccess();
1413 KOKKOS_INLINE_FUNCTION
1414 value_type
val()
const {
1416 return pow(c, expr2.val());
1419 KOKKOS_INLINE_FUNCTION
1420 val_type
val(
int j)
const {
1422 return pow(c.fastAccessCoeff(
j), expr2.val(
j));
1425 KOKKOS_INLINE_FUNCTION
1426 value_type
dx(
int i,
int j)
const {
1427 using std::pow;
using std::log;
1428 return expr2.dx(i,
j)*log(c.fastAccessCoeff(
j))*pow(c.fastAccessCoeff(
j),expr2.val(
j));
1431 KOKKOS_INLINE_FUNCTION
1433 using std::pow;
using std::log;
1434 return expr2.fastAccessDx(i,
j)*log(c.fastAccessCoeff(
j))*pow(c.fastAccessCoeff(
j),expr2.val(
j));