10 #ifndef SACADO_FAD_EXP_MP_VECTOR_HPP
11 #define SACADO_FAD_EXP_MP_VECTOR_HPP
32 typename std::enable_if<
33 Sacado::is_mp_vector<typename T::value_type>::value >::type
53 KOKKOS_INLINE_FUNCTION
57 KOKKOS_INLINE_FUNCTION
61 KOKKOS_INLINE_FUNCTION
63 return this->size() ? this->dx_[i].fastAccessCoeff(j) :
val_type(0.0);
67 KOKKOS_INLINE_FUNCTION
69 return this->dx_[i].fastAccessCoeff(j);
73 KOKKOS_INLINE_FUNCTION
75 return this->dx_[i].fastAccessCoeff(j);
81 template <
typename DstType>
84 typename std::enable_if<
85 std::is_same< typename DstType::expr_spec_type, ExprSpecMPVector >::value
94 static const int VecNum = Sacado::StaticSize<value_type>::value;
97 template <
typename SrcType>
98 KOKKOS_INLINE_FUNCTION
101 const int xsz = x.size();
103 if (xsz != dst.size())
104 dst.resizeAndZero(xsz);
106 const int sz = dst.size();
114 if (x.hasFastAccess()) {
115 SACADO_FAD_DERIV_LOOP(i,sz)
116 for (
int j=0;
j<VecNum; ++
j)
117 dst.fastAccessDx(i,
j) = x.fastAccessDx(i,
j);
120 SACADO_FAD_DERIV_LOOP(i,sz)
121 for (
int j=0;
j<VecNum; ++
j)
122 dst.fastAccessDx(i,
j) = x.dx(i,
j);
125 for (
int j=0;
j<VecNum; ++
j)
126 dst.val(
j) = x.val(
j);
130 template <
typename SrcType>
131 KOKKOS_INLINE_FUNCTION
134 const int xsz = x.size(), sz = dst.size();
136 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
137 if ((xsz != sz) && (xsz != 0) && (sz != 0))
138 throw "Fad Error: Attempt to assign with incompatible sizes";
143 if (x.hasFastAccess())
144 SACADO_FAD_DERIV_LOOP(i,sz)
145 for (
int j=0;
j<VecNum; ++
j)
146 dst.fastAccessDx(i,
j) += x.fastAccessDx(i,
j);
148 for (
int i=0; i<sz; ++i)
149 for (
int j=0;
j<VecNum; ++
j)
150 dst.fastAccessDx(i,
j) += x.dx(i,
j);
153 dst.resizeAndZero(xsz);
154 if (x.hasFastAccess())
155 SACADO_FAD_DERIV_LOOP(i,xsz)
156 for (
int j=0;
j<VecNum; ++
j)
157 dst.fastAccessDx(i,
j) = x.fastAccessDx(i,
j);
159 SACADO_FAD_DERIV_LOOP(i,xsz)
160 for (
int j=0;
j<VecNum; ++
j)
161 dst.fastAccessDx(i,
j) = x.dx(i,
j);
165 for (
int j=0;
j<VecNum; ++
j)
166 dst.val(
j) += x.val(
j);
170 template <
typename SrcType>
171 KOKKOS_INLINE_FUNCTION
174 const int xsz = x.size(), sz = dst.size();
176 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
177 if ((xsz != sz) && (xsz != 0) && (sz != 0))
178 throw "Fad Error: Attempt to assign with incompatible sizes";
183 if (x.hasFastAccess())
184 SACADO_FAD_DERIV_LOOP(i,sz)
185 for (
int j=0;
j<VecNum; ++
j)
186 dst.fastAccessDx(i,
j) -= x.fastAccessDx(i,
j);
188 SACADO_FAD_DERIV_LOOP(i,sz)
189 for (
int j=0;
j<VecNum; ++
j)
190 dst.fastAccessDx(i,
j) -= x.dx(i,
j);
193 dst.resizeAndZero(xsz);
194 if (x.hasFastAccess())
195 SACADO_FAD_DERIV_LOOP(i,xsz)
196 for (
int j=0;
j<VecNum; ++
j)
197 dst.fastAccessDx(i,
j) = -x.fastAccessDx(i,
j);
199 SACADO_FAD_DERIV_LOOP(i,xsz)
200 for (
int j=0;
j<VecNum; ++
j)
201 dst.fastAccessDx(i,
j) = -x.dx(i,
j);
205 for (
int j=0;
j<VecNum; ++
j)
206 dst.val(
j) -= x.val(
j);
210 template <
typename SrcType>
211 KOKKOS_INLINE_FUNCTION
214 const int xsz = x.size(), sz = dst.size();
218 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
219 if ((xsz != sz) && (xsz != 0) && (sz != 0))
220 throw "Fad Error: Attempt to assign with incompatible sizes";
225 if (x.hasFastAccess())
226 SACADO_FAD_DERIV_LOOP(i,sz)
227 for (
int j=0;
j<VecNum; ++
j)
228 dst.fastAccessDx(i) = v.fastAccessCoeff(
j)*x.fastAccessDx(i,
j) + dst.fastAccessDx(i,
j)*xval.fastAccessCoeff(
j);
230 SACADO_FAD_DERIV_LOOP(i,sz)
231 for (
int j=0;
j<VecNum; ++
j)
232 dst.fastAccessDx(i) = v.fastAccessCoeff(
j)*x.dx(i,
j) + dst.fastAccessDx(i,
j)*xval.fastAccessCoeff(
j);
235 dst.resizeAndZero(xsz);
236 if (x.hasFastAccess())
237 SACADO_FAD_DERIV_LOOP(i,xsz)
238 for (
int j=0;
j<VecNum; ++
j)
239 dst.fastAccessDx(i,
j) = v.fastAccessCoeff(
j)*x.fastAccessDx(i,
j);
241 SACADO_FAD_DERIV_LOOP(i,xsz)
242 for (
int j=0;
j<VecNum; ++
j)
243 dst.fastAccessDx(i,
j) = v.fastAccessCoeff(
j)*x.dx(i,
j);
248 SACADO_FAD_DERIV_LOOP(i,sz)
249 for (
int j=0;
j<VecNum; ++
j)
250 dst.fastAccessDx(i,
j) *= xval.fastAccessCoeff(
j);
254 for (
int j=0;
j<VecNum; ++
j)
255 dst.val(
j) *= xval.fastAccessCoeff(
j);
259 template <
typename SrcType>
260 KOKKOS_INLINE_FUNCTION
263 const int xsz = x.size(), sz = dst.size();
267 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
268 if ((xsz != sz) && (xsz != 0) && (sz != 0))
269 throw "Fad Error: Attempt to assign with incompatible sizes";
275 if (x.hasFastAccess())
276 SACADO_FAD_DERIV_LOOP(i,sz)
277 for (
int j=0;
j<VecNum; ++
j)
278 dst.fastAccessDx(i,
j) =
279 ( dst.fastAccessDx(i,
j)*xval.fastAccessCoeff(
j) - v.fastAccessCoeff(
j)*x.fastAccessDx(i,
j) ) / xval2.fastAccessCoeff(
j);
281 SACADO_FAD_DERIV_LOOP(i,sz)
282 for (
int j=0;
j<VecNum; ++
j)
283 dst.fastAccessDx(i,
j) =
284 ( dst.fastAccessDx(i,
j)*xval.fastAccessCoeff(
j) - v.fastAccessCoeff(
j)*x.dx(i,
j) ) / xval2.fastAccessCoeff(
j);
287 dst.resizeAndZero(xsz);
288 if (x.hasFastAccess())
289 SACADO_FAD_DERIV_LOOP(i,xsz)
290 for (
int j=0;
j<VecNum; ++
j)
291 dst.fastAccessDx(i,
j) = - v.fastAccessCoeff(
j)*x.fastAccessDx(i,
j) / xval2.fastAccessCoeff(
j);
293 SACADO_FAD_DERIV_LOOP(i,xsz)
294 for (
int j=0;
j<VecNum; ++
j)
295 dst.fastAccessDx(i,
j) = -v.fastAccessCoeff(
j)*x.dx(i,
j) / xval2.fastAccessCoeff(
j);
300 SACADO_FAD_DERIV_LOOP(i,sz)
301 for (
int j=0;
j<VecNum; ++
j)
302 dst.fastAccessDx(i,
j) /= xval.fastAccessCoeff(
j);
306 for (
int j=0;
j<VecNum; ++
j)
307 dst.val(
j) /= xval.fastAccessCoeff(
j);
316 template <
typename DstType>
319 typename std::enable_if<
320 Sacado::IsStaticallySized<DstType>::value &&
321 std::is_same< typename DstType::expr_spec_type, ExprSpecMPVector >::value
330 static const int VecNum = Sacado::StaticSize<value_type>::value;
333 template <
typename SrcType>
334 KOKKOS_INLINE_FUNCTION
337 const int sz = dst.size();
338 SACADO_FAD_DERIV_LOOP(i,sz)
339 for (
int j=0;
j<VecNum; ++
j)
340 dst.fastAccessDx(i,
j) = x.fastAccessDx(i,
j);
341 for (
int j=0;
j<VecNum; ++
j)
342 dst.val(
j) = x.val(
j);
346 template <
typename SrcType>
347 KOKKOS_INLINE_FUNCTION
350 const int sz = dst.size();
351 SACADO_FAD_DERIV_LOOP(i,sz)
352 for (
int j=0;
j<VecNum; ++
j)
353 dst.fastAccessDx(i,
j) += x.fastAccessDx(i,
j);
354 for (
int j=0;
j<VecNum; ++
j)
355 dst.val(
j) += x.val(
j);
359 template <
typename SrcType>
360 KOKKOS_INLINE_FUNCTION
363 const int sz = dst.size();
364 SACADO_FAD_DERIV_LOOP(i,sz)
365 for (
int j=0;
j<VecNum; ++
j)
366 dst.fastAccessDx(i,
j) -= x.fastAccessDx(i,
j);
367 for (
int j=0;
j<VecNum; ++
j)
368 dst.val(
j) -= x.val(
j);
372 template <
typename SrcType>
373 KOKKOS_INLINE_FUNCTION
376 const int sz = dst.size();
379 SACADO_FAD_DERIV_LOOP(i,sz)
380 for (
int j=0;
j<VecNum; ++
j)
381 dst.fastAccessDx(i,
j) = v.fastAccessCoeff(
j)*x.fastAccessDx(i,
j) + dst.fastAccessDx(i,
j)*xval.fastAccessCoeff(
j);
382 for (
int j=0;
j<VecNum; ++
j)
383 dst.val(
j) *= xval.fastAccessCoeff(
j);
387 template <
typename SrcType>
388 KOKKOS_INLINE_FUNCTION
391 const int sz = dst.size();
395 SACADO_FAD_DERIV_LOOP(i,sz)
396 for (
int j=0;
j<VecNum; ++
j)
397 dst.fastAccessDx(i,
j) =
398 ( dst.fastAccessDx(i,
j)*xval.fastAccessCoeff(
j) - v.fastAccessCoeff(
j)*x.fastAccessDx(i,
j) )/ xval2.fastAccessCoeff(
j);
399 for (
int j=0;
j<VecNum; ++
j)
400 dst.val(
j) /= xval.fastAccessCoeff(
j);
411 #include "Sacado_Fad_Exp_Ops.hpp"
413 #define FAD_UNARYOP_MACRO(OPNAME,OP,USING,MPVALUE,VALUE,DX,FASTACCESSDX) \
418 template <typename T> \
419 class OP< T,ExprSpecMPVector > : \
420 public Expr< OP< T,ExprSpecMPVector > > { \
423 typedef typename std::remove_cv<T>::type ExprT; \
424 typedef typename ExprT::value_type value_type; \
425 typedef typename ExprT::scalar_type scalar_type; \
427 typedef typename value_type::value_type val_type; \
429 typedef ExprSpecMPVector expr_spec_type; \
431 KOKKOS_INLINE_FUNCTION \
432 OP(const T& expr_) : expr(expr_) {} \
434 KOKKOS_INLINE_FUNCTION \
435 int size() const { return expr.size(); } \
437 KOKKOS_INLINE_FUNCTION \
438 bool hasFastAccess() const { \
439 return expr.hasFastAccess(); \
442 KOKKOS_INLINE_FUNCTION \
443 value_type val() const { \
448 KOKKOS_INLINE_FUNCTION \
449 val_type val(int j) const { \
454 KOKKOS_INLINE_FUNCTION \
455 val_type dx(int i, int j) const { \
460 KOKKOS_INLINE_FUNCTION \
461 val_type fastAccessDx(int i, int j) const { \
463 return FASTACCESSDX; \
482 expr.fastAccessDx(i,
j))
489 -expr.fastAccessDx(i,
j))
496 exp(expr.val(
j))*expr.fastAccessDx(i,
j))
502 expr.dx(i,
j)/expr.val(
j),
503 expr.fastAccessDx(i,
j)/expr.val(
j))
520 using std::cos; using std::
sin;,
523 -expr.
dx(i,j)* sin(expr.val()),
527 using std::cos; using std::sin;,
530 expr.
dx(i,j)* cos(expr.val()),
538 (
value_type(1)+ tan(expr.val())* tan(expr.val())),
540 (
value_type(1)+ tan(expr.val())* tan(expr.val())))
543 using std::acos; using std::sqrt;,
546 -expr.
dx(i,j)/ sqrt(
value_type(1)-expr.val()*expr.val()),
551 using std::asin; using std::sqrt;,
554 expr.
dx(i,j)/ sqrt(
value_type(1)-expr.val()*expr.val()),
566 using std::cosh; using std::
sinh;,
569 expr.
dx(i,j)* sinh(expr.val()),
573 using std::cosh; using std::sinh;,
576 expr.
dx(i,j)* cosh(expr.val()),
580 using std::tanh; using std::cosh;,
583 expr.
dx(i,j)/( cosh(expr.val())* cosh(expr.val())),
585 ( cosh(expr.val())* cosh(expr.val())))
588 using std::acosh; using std::sqrt;,
593 expr.
fastAccessDx(i,j)/ sqrt((expr.val()-value_type(1)) *
594 (expr.val()+value_type(1))))
597 using std::asinh; using std::sqrt;,
600 expr.
dx(i,j)/ sqrt(value_type(1)+expr.val()*expr.val()),
602 expr.val()*expr.val()))
608 expr.
dx(i,j)/(value_type(1)-expr.val()*expr.val()),
610 expr.val()*expr.val()))
630 expr.
dx(i,j)/(value_type(3)*cbrt(expr.val()*expr.val())),
633 #undef FAD_UNARYOP_MACRO
644 template <
typename ConstType,
typename ValueType>
645 struct ConstTypeRef {
646 typedef ValueType type;
649 template <
typename ValueType>
650 struct ConstTypeRef<ValueType, ValueType> {
651 typedef ValueType& type;
657 #define FAD_BINARYOP_MACRO(OPNAME,OP,USING,MPVALUE,VALUE,DX,CDX1,CDX2,FASTACCESSDX,MPVAL_CONST_DX_1,MPVAL_CONST_DX_2,VAL_CONST_DX_1,VAL_CONST_DX_2,CONST_DX_1,CONST_DX_2,CONST_FASTACCESSDX_1,CONST_FASTACCESSDX_2) \
662 template <typename T1, typename T2 > \
663 class OP< T1, T2, false, false, ExprSpecMPVector > : \
664 public Expr< OP< T1, T2, false, false, ExprSpecMPVector > > { \
667 typedef typename std::remove_cv<T1>::type ExprT1; \
668 typedef typename std::remove_cv<T2>::type ExprT2; \
669 typedef typename ExprT1::value_type value_type_1; \
670 typedef typename ExprT2::value_type value_type_2; \
671 typedef typename Sacado::Promote<value_type_1, \
672 value_type_2>::type value_type; \
674 typedef typename ExprT1::scalar_type scalar_type_1; \
675 typedef typename ExprT2::scalar_type scalar_type_2; \
676 typedef typename Sacado::Promote<scalar_type_1, \
677 scalar_type_2>::type scalar_type; \
679 typedef typename value_type::value_type val_type; \
681 typedef ExprSpecMPVector expr_spec_type; \
683 KOKKOS_INLINE_FUNCTION \
684 OP(const T1& expr1_, const T2& expr2_) : \
685 expr1(expr1_), expr2(expr2_) {} \
687 KOKKOS_INLINE_FUNCTION \
689 const int sz1 = expr1.size(), sz2 = expr2.size(); \
690 return sz1 > sz2 ? sz1 : sz2; \
693 KOKKOS_INLINE_FUNCTION \
694 bool hasFastAccess() const { \
695 return expr1.hasFastAccess() && expr2.hasFastAccess(); \
698 KOKKOS_INLINE_FUNCTION \
699 value_type val() const { \
704 KOKKOS_INLINE_FUNCTION \
705 val_type val(int j) const { \
710 KOKKOS_INLINE_FUNCTION \
711 val_type dx(int i, int j) const { \
713 const int sz1 = expr1.size(), sz2 = expr2.size(); \
714 if (sz1 > 0 && sz2 > 0) \
722 KOKKOS_INLINE_FUNCTION \
723 val_type fastAccessDx(int i, int j) const { \
725 return FASTACCESSDX; \
735 template <typename T1, typename T2> \
736 class OP< T1, T2, false, true, ExprSpecMPVector > : \
737 public Expr< OP< T1, T2, false, true, ExprSpecMPVector > > { \
740 typedef typename std::remove_cv<T1>::type ExprT1; \
742 typedef typename ExprT1::value_type value_type; \
743 typedef typename ExprT1::scalar_type scalar_type; \
745 typedef typename value_type::value_type val_type; \
747 typedef ExprSpecMPVector expr_spec_type; \
749 KOKKOS_INLINE_FUNCTION \
750 OP(const T1& expr1_, const ConstT& c_) : \
751 expr1(expr1_), c(c_) {} \
753 KOKKOS_INLINE_FUNCTION \
755 return expr1.size(); \
758 KOKKOS_INLINE_FUNCTION \
759 bool hasFastAccess() const { \
760 return expr1.hasFastAccess(); \
763 KOKKOS_INLINE_FUNCTION \
764 value_type val() const { \
766 return MPVAL_CONST_DX_2; \
769 KOKKOS_INLINE_FUNCTION \
770 val_type val(int j) const { \
772 return VAL_CONST_DX_2; \
775 KOKKOS_INLINE_FUNCTION \
776 val_type dx(int i, int j) const { \
781 KOKKOS_INLINE_FUNCTION \
782 val_type fastAccessDx(int i, int j) const { \
784 return CONST_FASTACCESSDX_2; \
790 const typename ConstTypeRef<ConstT,value_type>::type c; \
793 template <typename T1, typename T2> \
794 class OP< T1, T2, true, false,ExprSpecMPVector > : \
795 public Expr< OP< T1, T2, true, false, ExprSpecMPVector > > { \
798 typedef typename std::remove_cv<T2>::type ExprT2; \
800 typedef typename ExprT2::value_type value_type; \
801 typedef typename ExprT2::scalar_type scalar_type; \
803 typedef typename value_type::value_type val_type; \
805 typedef ExprSpecMPVector expr_spec_type; \
807 KOKKOS_INLINE_FUNCTION \
808 OP(const ConstT& c_, const T2& expr2_) : \
809 c(c_), expr2(expr2_) {} \
811 KOKKOS_INLINE_FUNCTION \
813 return expr2.size(); \
816 KOKKOS_INLINE_FUNCTION \
817 bool hasFastAccess() const { \
818 return expr2.hasFastAccess(); \
821 KOKKOS_INLINE_FUNCTION \
822 value_type val() const { \
824 return MPVAL_CONST_DX_1; \
827 KOKKOS_INLINE_FUNCTION \
828 val_type val(int j) const { \
830 return VAL_CONST_DX_1; \
833 KOKKOS_INLINE_FUNCTION \
834 val_type dx(int i, int j) const { \
839 KOKKOS_INLINE_FUNCTION \
840 val_type fastAccessDx(int i, int j) const { \
842 return CONST_FASTACCESSDX_1; \
847 const typename ConstTypeRef<ConstT,value_type>::type c; \
860 expr1.val() + expr2.val(),
861 expr1.val(j) + expr2.val(j),
862 expr1.dx(i,j) + expr2.dx(i,j),
865 expr1.fastAccessDx(i,j) + expr2.fastAccessDx(i,j),
868 c.fastAccessCoeff(j) + expr2.val(j),
869 expr1.val(j) + c.fastAccessCoeff(j),
872 expr2.fastAccessDx(i,j),
873 expr1.fastAccessDx(i,j))
877 expr1.val() - expr2.val(),
878 expr1.val(j) - expr2.val(j),
879 expr1.dx(i,j) - expr2.dx(i,j),
882 expr1.fastAccessDx(i,j) - expr2.fastAccessDx(i,j),
885 c.fastAccessCoeff(j) - expr2.val(j),
886 expr1.val(j) - c.fastAccessCoeff(j),
889 -expr2.fastAccessDx(i,j),
890 expr1.fastAccessDx(i,j))
894 expr1.val() * expr2.val(),
895 expr1.val(j) * expr2.val(j),
896 expr1.val(j)*expr2.dx(i,j) + expr1.dx(i,j)*expr2.val(j),
897 expr1.val(j)*expr2.dx(i,j),
898 expr1.dx(i,j)*expr2.val(j),
899 expr1.val(j)*expr2.fastAccessDx(i,j) +
900 expr1.fastAccessDx(i,j)*expr2.val(j),
903 c.fastAccessCoeff(j) * expr2.val(j),
904 expr1.val(j) * c.fastAccessCoeff(j),
905 c.fastAccessCoeff(j)*expr2.dx(i,j),
906 expr1.dx(i,j)*c.fastAccessCoeff(j),
907 c.fastAccessCoeff(j)*expr2.fastAccessDx(i,j),
908 expr1.fastAccessDx(i,j)*c.fastAccessCoeff(j))
912 expr1.val() / expr2.val(),
913 expr1.val(j) / expr2.val(j),
914 (expr1.dx(i,j)*expr2.val(j) - expr2.dx(i,j)*expr1.val(j)) /
915 (expr2.val(j)*expr2.val(j)),
916 -expr2.dx(i,j)*expr1.val(j) / (expr2.val(j)*expr2.val(j)),
917 expr1.dx(i,j)/expr2.val(j),
918 (expr1.fastAccessDx(i,j)*expr2.val(j) -
919 expr2.fastAccessDx(i,j)*expr1.val(j)) /
920 (expr2.val(j)*expr2.val(j)),
923 c.fastAccessCoeff(j) / expr2.val(j),
924 expr1.val(j) / c.fastAccessCoeff(j),
925 -expr2.dx(i,j)*c.fastAccessCoeff(j) / (expr2.val(j)*expr2.val(j)),
926 expr1.dx(i,j)/c.fastAccessCoeff(j),
927 -expr2.fastAccessDx(i,j)*c.fastAccessCoeff(j) / (expr2.val(j)*expr2.val(j)),
928 expr1.fastAccessDx(i,j)/c.fastAccessCoeff(j))
932 atan2(expr1.val(), expr2.val()),
933 atan2(expr1.val(j), expr2.val(j)),
934 (expr2.val(j)*expr1.dx(i,j) - expr1.val(j)*expr2.dx(i,j))/
935 (expr1.val(j)*expr1.val(j) + expr2.val(j)*expr2.val(j)),
936 -expr1.val(j)*expr2.dx(i,j)/
937 (expr1.val(j)*expr1.val(j) + expr2.val(j)*expr2.val(j)),
938 expr2.val(j)*expr1.dx(i,j)/
939 (expr1.val(j)*expr1.val(j) + expr2.val(j)*expr2.val(j)),
940 (expr2.val(j)*expr1.fastAccessDx(i,j) - expr1.val(j)*expr2.fastAccessDx(i,j))/
941 (expr1.val(j)*expr1.val(j) + expr2.val(j)*expr2.val(j)),
942 atan2(c, expr2.val()),
943 atan2(expr1.val(), c),
944 atan2(c.fastAccessCoeff(j), expr2.val(j)),
945 atan2(expr1.val(j), c.fastAccessCoeff(j)),
946 (-c.fastAccessCoeff(j)*expr2.dx(i,j)) / (c.fastAccessCoeff(j)*c.fastAccessCoeff(j) + expr2.val(j)*expr2.val(j)),
947 (c.fastAccessCoeff(j)*expr1.dx(i,j))/ (expr1.val(j)*expr1.val(j) + c.fastAccessCoeff(j)*c.fastAccessCoeff(j)),
948 (-c.fastAccessCoeff(j)*expr2.fastAccessDx(i,j))/ (c.fastAccessCoeff(j)*c.fastAccessCoeff(j) + expr2.val(j)*expr2.val(j)),
949 (c.fastAccessCoeff(j)*expr1.fastAccessDx(i,j))/ (expr1.val(j)*expr1.val(j) + c.fastAccessCoeff(j)*c.fastAccessCoeff(j)))
970 if_then_else( expr1.val() >= expr2.val(), expr1.val(), expr2.val() ),
971 if_then_else( expr1.val(j) >= expr2.val(j), expr1.val(j), expr2.val(j) ),
973 if_then_else( expr1.val(j) >= expr2.val(j), val_type(0.0), expr2.
dx(i,j) ),
974 if_then_else( expr1.val(j) >= expr2.val(j), expr1.
dx(i,j), val_type(0.0) ),
987 if_then_else( expr1.val() <= expr2.val(), expr1.val(), expr2.val() ),
988 if_then_else( expr1.val(j) <= expr2.val(j), expr1.val(j), expr2.val(j) ),
990 if_then_else( expr1.val(j) <= expr2.val(j), val_type(0.0), expr2.
dx(i,j) ),
991 if_then_else( expr1.val(j) <= expr2.val(j), expr1.
dx(i,j), val_type(0.0) ),
1013 template <
typename T1,
typename T2>
1014 class PowerOp< T1, T2, false, false, ExprSpecMPVector, PowerImpl::Simd > :
1015 public Expr< PowerOp< T1, T2, false, false, ExprSpecMPVector,
1016 PowerImpl::Simd > > {
1019 typedef typename std::remove_cv<T1>::type ExprT1;
1020 typedef typename std::remove_cv<T2>::type ExprT2;
1023 typedef typename Sacado::Promote<value_type_1,
1028 typedef typename Sacado::Promote<scalar_type_1,
1033 typedef ExprSpecMPVector expr_spec_type;
1035 KOKKOS_INLINE_FUNCTION
1036 PowerOp(
const T1& expr1_,
const T2& expr2_) :
1037 expr1(expr1_), expr2(expr2_) {}
1039 KOKKOS_INLINE_FUNCTION
1041 const int sz1 = expr1.size(), sz2 = expr2.size();
1042 return sz1 > sz2 ? sz1 : sz2;
1045 KOKKOS_INLINE_FUNCTION
1046 bool hasFastAccess()
const {
1047 return expr1.hasFastAccess() && expr2.hasFastAccess();
1050 KOKKOS_INLINE_FUNCTION
1051 value_type
val()
const {
1053 return pow(expr1.val(), expr2.val());
1056 KOKKOS_INLINE_FUNCTION
1057 val_type
val(
int j)
const {
1059 return pow(expr1.val(j), expr2.val(j));
1062 KOKKOS_INLINE_FUNCTION
1063 val_type
dx(
int i,
int j)
const {
1065 const int sz1 = expr1.size(), sz2 = expr2.size();
1066 if (sz1 > 0 && sz2 > 0)
1067 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))) );
1071 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))) ));
1073 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))) );
1076 KOKKOS_INLINE_FUNCTION
1079 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))) );
1089 template <
typename T1,
typename T2>
1090 class PowerOp< T1, T2, false, true, ExprSpecMPVector, PowerImpl::Simd >
1091 :
public Expr< PowerOp< T1, T2, false, true, ExprSpecMPVector,
1092 PowerImpl::Simd > > {
1095 typedef typename std::remove_cv<T1>::type ExprT1;
1102 typedef ExprSpecMPVector expr_spec_type;
1104 KOKKOS_INLINE_FUNCTION
1105 PowerOp(
const T1& expr1_,
const ConstT& c_) :
1106 expr1(expr1_), c(c_) {}
1108 KOKKOS_INLINE_FUNCTION
1110 return expr1.size();
1113 KOKKOS_INLINE_FUNCTION
1114 bool hasFastAccess()
const {
1115 return expr1.hasFastAccess();
1118 KOKKOS_INLINE_FUNCTION
1119 value_type
val()
const {
1121 return pow(expr1.val(), c);
1124 KOKKOS_INLINE_FUNCTION
1125 val_type
val(
int j)
const {
1127 return pow(expr1.val(j), c.fastAccessCoeff(j));
1130 KOKKOS_INLINE_FUNCTION
1131 val_type
dx(
int i,
int j)
const {
1135 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))) ));
1138 KOKKOS_INLINE_FUNCTION
1143 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))) ));
1152 template <
typename T1,
typename T2>
1153 class PowerOp< T1, T2, true, false, ExprSpecMPVector, PowerImpl::Simd >
1154 :
public Expr< PowerOp< T1, T2, true, false, ExprSpecMPVector,
1155 PowerImpl::Simd> > {
1158 typedef typename std::remove_cv<T2>::type ExprT2;
1165 typedef ExprSpecMPVector expr_spec_type;
1167 KOKKOS_INLINE_FUNCTION
1168 PowerOp(
const ConstT& c_,
const T2& expr2_) :
1169 c(c_), expr2(expr2_) {}
1171 KOKKOS_INLINE_FUNCTION
1173 return expr2.size();
1176 KOKKOS_INLINE_FUNCTION
1177 bool hasFastAccess()
const {
1178 return expr2.hasFastAccess();
1181 KOKKOS_INLINE_FUNCTION
1182 value_type
val()
const {
1184 return pow(c, expr2.val());
1187 KOKKOS_INLINE_FUNCTION
1188 val_type
val(
int j)
const {
1190 return pow(c.fastAccessCoeff(j), expr2.val(j));
1193 KOKKOS_INLINE_FUNCTION
1194 val_type
dx(
int i,
int j)
const {
1196 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))) );
1199 KOKKOS_INLINE_FUNCTION
1202 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))) );
1216 template <
typename T1,
typename T2>
1217 class PowerOp< T1, T2, false, false, ExprSpecMPVector,
1218 PowerImpl::NestedSimd > :
1219 public Expr< PowerOp< T1, T2, false, false, ExprSpecMPVector,
1220 PowerImpl::NestedSimd > > {
1223 typedef typename std::remove_cv<T1>::type ExprT1;
1224 typedef typename std::remove_cv<T2>::type ExprT2;
1227 typedef typename Sacado::Promote<value_type_1,
1232 typedef typename Sacado::Promote<scalar_type_1,
1237 typedef ExprSpecMPVector expr_spec_type;
1239 KOKKOS_INLINE_FUNCTION
1240 PowerOp(
const T1& expr1_,
const T2& expr2_) :
1241 expr1(expr1_), expr2(expr2_) {}
1243 KOKKOS_INLINE_FUNCTION
1245 const int sz1 = expr1.size(), sz2 = expr2.size();
1246 return sz1 > sz2 ? sz1 : sz2;
1249 KOKKOS_INLINE_FUNCTION
1250 bool hasFastAccess()
const {
1251 return expr1.hasFastAccess() && expr2.hasFastAccess();
1254 KOKKOS_INLINE_FUNCTION
1255 value_type
val()
const {
1257 return pow(expr1.val(), expr2.val());
1260 KOKKOS_INLINE_FUNCTION
1261 val_type
val(
int j)
const {
1263 return pow(expr1.val(j), expr2.val(j));
1266 KOKKOS_INLINE_FUNCTION
1267 value_type
dx(
int i,
int j)
const {
1269 const int sz1 = expr1.size(), sz2 = expr2.size();
1270 if (sz1 > 0 && sz2 > 0)
1271 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));
1275 return expr2.dx(i,j)*
log(expr1.val(j))*
pow(expr1.val(j),expr2.val(j));
1278 KOKKOS_INLINE_FUNCTION
1281 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));
1291 template <
typename T1,
typename T2>
1292 class PowerOp< T1, T2, false, true, ExprSpecMPVector,
1293 PowerImpl::NestedSimd > :
1294 public Expr< PowerOp< T1, T2, false, true, ExprSpecMPVector,
1295 PowerImpl::NestedSimd > > {
1298 typedef typename std::remove_cv<T1>::type ExprT1;
1305 typedef ExprSpecMPVector expr_spec_type;
1307 KOKKOS_INLINE_FUNCTION
1308 PowerOp(
const T1& expr1_,
const ConstT& c_) :
1309 expr1(expr1_), c(c_) {}
1311 KOKKOS_INLINE_FUNCTION
1313 return expr1.size();
1316 KOKKOS_INLINE_FUNCTION
1317 bool hasFastAccess()
const {
1318 return expr1.hasFastAccess();
1321 KOKKOS_INLINE_FUNCTION
1322 value_type
val()
const {
1324 return pow(expr1.val(), c);
1327 KOKKOS_INLINE_FUNCTION
1328 val_type
val(
int j)
const {
1330 return pow(expr1.val(j), c.fastAccessCoeff(j));
1333 KOKKOS_INLINE_FUNCTION
1334 value_type
dx(
int i,
int j)
const {
1339 KOKKOS_INLINE_FUNCTION
1351 template <
typename T1,
typename T2>
1352 class PowerOp<T1, T2, true, false, ExprSpecMPVector,
1353 PowerImpl::NestedSimd > :
1354 public Expr< PowerOp< T1, T2, true, false, ExprSpecMPVector,
1355 PowerImpl::NestedSimd > > {
1358 typedef typename std::remove_cv<T2>::type ExprT2;
1365 typedef ExprSpecMPVector expr_spec_type;
1367 KOKKOS_INLINE_FUNCTION
1368 PowerOp(
const ConstT& c_,
const T2& expr2_) :
1369 c(c_), expr2(expr2_) {}
1371 KOKKOS_INLINE_FUNCTION
1373 return expr2.size();
1376 KOKKOS_INLINE_FUNCTION
1377 bool hasFastAccess()
const {
1378 return expr2.hasFastAccess();
1381 KOKKOS_INLINE_FUNCTION
1382 value_type
val()
const {
1384 return pow(c, expr2.val());
1387 KOKKOS_INLINE_FUNCTION
1388 val_type
val(
int j)
const {
1390 return pow(c.fastAccessCoeff(j), expr2.val(j));
1393 KOKKOS_INLINE_FUNCTION
1394 value_type
dx(
int i,
int j)
const {
1396 return expr2.dx(i,j)*
log(c.fastAccessCoeff(j))*
pow(c.fastAccessCoeff(j),expr2.val(j));
1399 KOKKOS_INLINE_FUNCTION
1402 return expr2.fastAccessDx(i,j)*
log(c.fastAccessCoeff(j))*
pow(c.fastAccessCoeff(j),expr2.val(j));
1423 template <
typename CondT,
typename T1,
typename T2>
1425 public Expr< IfThenElseOp< CondT, T1, T2, false, false, ExprSpecMPVector > > {
1429 typedef typename std::remove_cv<T1>::type
ExprT1;
1430 typedef typename std::remove_cv<T2>::type
ExprT2;
1445 KOKKOS_INLINE_FUNCTION
1447 cond(cond_), expr1(expr1_), expr2(expr2_) {}
1449 KOKKOS_INLINE_FUNCTION
1451 int sz1 = expr1.size(), sz2 = expr2.size();
1452 return sz1 > sz2 ? sz1 : sz2;
1455 KOKKOS_INLINE_FUNCTION
1457 return expr1.hasFastAccess() && expr2.hasFastAccess();
1460 KOKKOS_INLINE_FUNCTION
1465 KOKKOS_INLINE_FUNCTION
1467 return if_then_else( cond, expr1.val(j), expr2.val(j) );
1470 KOKKOS_INLINE_FUNCTION
1472 return if_then_else( cond, expr1.dx(i,j), expr2.dx(i,j) );
1475 KOKKOS_INLINE_FUNCTION
1477 return if_then_else( cond, expr1.fastAccessDx(i,j), expr2.fastAccessDx(i,j) );
1488 template <
typename CondT,
typename T1,
typename T2>
1490 public Expr< IfThenElseOp< CondT, T1, T2, false, true, ExprSpecMPVector > > {
1494 typedef typename std::remove_cv<T1>::type
ExprT1;
1501 KOKKOS_INLINE_FUNCTION
1503 cond(cond_), expr1(expr1_), c(c_) {}
1505 KOKKOS_INLINE_FUNCTION
1507 return expr1.size();
1510 KOKKOS_INLINE_FUNCTION
1512 return expr1.hasFastAccess();
1515 KOKKOS_INLINE_FUNCTION
1520 KOKKOS_INLINE_FUNCTION
1522 return if_then_else( cond, expr1.val(j), c.fastAccessCoeff(j) );
1525 KOKKOS_INLINE_FUNCTION
1530 KOKKOS_INLINE_FUNCTION
1539 const typename ConstTypeRef<ConstT,value_type>::type
c;
1542 template <
typename CondT,
typename T1,
typename T2>
1544 public Expr< IfThenElseOp< CondT, T1, T2, true, false, ExprSpecMPVector > > {
1548 typedef typename std::remove_cv<T2>::type
ExprT2;
1557 KOKKOS_INLINE_FUNCTION
1559 cond(cond_), c(c_), expr2(expr2_) {}
1561 KOKKOS_INLINE_FUNCTION
1563 return expr2.size();
1566 KOKKOS_INLINE_FUNCTION
1568 return expr2.hasFastAccess();
1571 KOKKOS_INLINE_FUNCTION
1576 KOKKOS_INLINE_FUNCTION
1578 return if_then_else( cond, c.fastAccessCoeff(j), expr2.val(j) );
1581 KOKKOS_INLINE_FUNCTION
1586 KOKKOS_INLINE_FUNCTION
1594 const typename ConstTypeRef<ConstT,value_type>::type
c;
1602 #undef FAD_BINARYOP_MACRO
1604 #endif // SACADO_FAD_EXP_MP_VECTOR_HPP
static KOKKOS_INLINE_FUNCTION void assign_plus_equal(DstType &dst, const SrcType &x)
Implementation of dst += x.
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION val_type dx(int i, int j) const
KOKKOS_INLINE_FUNCTION PCE< Storage > fabs(const PCE< Storage > &a)
value_type::value_type val_type
KOKKOS_INLINE_FUNCTION PCE< Storage > tan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION IfThenElseOp(const CondT &cond_, const ConstT &c_, const T2 &expr2_)
std::remove_cv< T2 >::type ExprT2
std::remove_cv< T1 >::type ExprT1
ExprSpecMPVector expr_spec_type
KOKKOS_INLINE_FUNCTION const val_type & val(int j) const
Returns value.
KOKKOS_INLINE_FUNCTION PCE< Storage > sinh(const PCE< Storage > &a)
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c expr1 expr2 expr1 expr2 expr1 MultiplicationOp
const ConstTypeRef< ConstT, value_type >::type c
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 j expr1 expr1 expr1 expr1 j expr1 c *expr2 expr1 c expr1 c expr1 c expr1 DivisionOp
ExprT1::value_type value_type_1
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
DstType::value_type value_type
Typename of values.
value_type::value_type val_type
KOKKOS_INLINE_FUNCTION IfThenElseOp(const CondT &cond_, const T1 &expr1_, const ConstT &c_)
value_type::value_type val_type
static KOKKOS_INLINE_FUNCTION void assign_minus_equal(DstType &dst, const SrcType &x)
Implementation of dst -= x.
KOKKOS_INLINE_FUNCTION val_type dx(int i, int j) const
static KOKKOS_INLINE_FUNCTION void assign_times_equal(DstType &dst, const SrcType &x)
Implementation of dst *= x.
KOKKOS_INLINE_FUNCTION PCE< Storage > tanh(const PCE< Storage > &a)
DstType::value_type value_type
Typename of values.
#define FAD_BINARYOP_MACRO(OPNAME, OP, USING, MPVALUE, VALUE, DX, CDX1, CDX2, FASTACCESSDX, MPVAL_CONST_DX_1, MPVAL_CONST_DX_2, VAL_CONST_DX_1, VAL_CONST_DX_2, CONST_DX_1, CONST_DX_2, CONST_FASTACCESSDX_1, CONST_FASTACCESSDX_2)
KOKKOS_INLINE_FUNCTION PCE< Storage > cbrt(const PCE< Storage > &a)
Sacado::Promote< value_type_1, value_type_2 >::type value_type
static KOKKOS_INLINE_FUNCTION void assign_divide_equal(DstType &dst, const SrcType &x)
Implementation of dst /= x.
static KOKKOS_INLINE_FUNCTION void assign_plus_equal(DstType &dst, const SrcType &x)
Implementation of dst += x.
ExprT1::value_type value_type
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
static KOKKOS_INLINE_FUNCTION void assign_minus_equal(DstType &dst, const SrcType &x)
Implementation of dst -= x.
KOKKOS_INLINE_FUNCTION PCE< Storage > acos(const PCE< Storage > &a)
atan2(expr1.val(), expr2.val())
KOKKOS_INLINE_FUNCTION PCE< Storage > min(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
KOKKOS_INLINE_FUNCTION val_type fastAccessDx(int i, int j) const
KOKKOS_INLINE_FUNCTION const val_type & fastAccessDx(int i, int j) const
Returns derivative component i without bounds checking.
ExprT2::value_type value_type_2
KOKKOS_INLINE_FUNCTION val_type dx(int i, int j) const
Returns derivative component i with bounds checking.
KOKKOS_INLINE_FUNCTION val_type val(int j) const
static KOKKOS_INLINE_FUNCTION void assign_times_equal(DstType &dst, const SrcType &x)
Implementation of dst *= x.
expr2 j expr1 expr1 expr2 expr2 j expr1 c c c c MaxOp
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 j expr1 expr1 expr1 expr1 j expr1 c *expr2 expr1 c expr1 c expr1 c expr1 expr1 expr1 expr1 j *expr1 expr2 expr1 expr1 j *expr1 c expr2 expr1 c expr1 expr2 expr1 expr2 expr1 Atan2Op
ExprT2::scalar_type scalar_type_2
ExprSpecMPVector expr_spec_type
KOKKOS_INLINE_FUNCTION PCE< Storage > max(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
KOKKOS_INLINE_FUNCTION val_type fastAccessDx(int i, int j) const
expr expr expr expr fastAccessDx(i, j)) FAD_UNARYOP_MACRO(exp
KOKKOS_INLINE_FUNCTION PCE< Storage > cosh(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION val_type fastAccessDx(int i, int j) const
Sacado::Promote< scalar_type_1, scalar_type_2 >::type scalar_type
#define FAD_UNARYOP_MACRO(OPNAME, OP, USING, MPVALUE, VALUE, DX, FASTACCESSDX)
std::remove_cv< T1 >::type ExprT1
static KOKKOS_INLINE_FUNCTION void assign_equal(DstType &dst, const SrcType &x)
Implementation of dst = x.
if_then_else(expr.val() >=0, expr.dx(i, j), value_type(-expr.dx(i, j)))
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c fastAccessCoeff(j)-expr2.val(j)
ExprT2::scalar_type scalar_type
value_type::value_type val_type
static KOKKOS_INLINE_FUNCTION void assign_equal(DstType &dst, const SrcType &x)
Implementation of dst = x.
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION int size() const
KOKKOS_INLINE_FUNCTION val_type & val(int j)
Returns value.
expr2 j expr1 expr1 expr2 expr2 j expr1 c c c c MinOp
ExprSpecMPVector expr_spec_type
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
ExprT1::scalar_type scalar_type_1
KOKKOS_INLINE_FUNCTION value_type val() const
ExprT1::scalar_type scalar_type
KOKKOS_INLINE_FUNCTION val_type & fastAccessDx(int i, int j)
Returns derivative component i without bounds checking.
expr expr expr expr ExpOp
KOKKOS_INLINE_FUNCTION val_type dx(int i, int j) const
std::remove_cv< T2 >::type ExprT2
KOKKOS_INLINE_FUNCTION PCE< Storage > sin(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
static KOKKOS_INLINE_FUNCTION void assign_divide_equal(DstType &dst, const SrcType &x)
Implementation of dst /= x.
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
Expression template specialization tag for Fad< MP::Vector >
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
const ConstTypeRef< ConstT, value_type >::type c
KOKKOS_INLINE_FUNCTION PCE< Storage > asin(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION value_type val() const
KOKKOS_INLINE_FUNCTION PCE< Storage > cos(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION val_type val(int j) const
KOKKOS_INLINE_FUNCTION IfThenElseOp(const CondT &cond_, const T1 &expr1_, const T2 &expr2_)
ExprT2::value_type value_type
KOKKOS_INLINE_FUNCTION value_type val() const
KOKKOS_INLINE_FUNCTION val_type val(int j) const