10 #ifndef KOKKOS_ARITHTRAITS_MP_VECTOR_HPP
11 #define KOKKOS_ARITHTRAITS_MP_VECTOR_HPP
14 #if KOKKOS_VERSION >= 40799
15 #include "KokkosKernels_ArithTraits.hpp"
17 #include "Kokkos_ArithTraits.hpp"
19 #include "KokkosBatched_Vector.hpp"
25 #if KOKKOS_VERSION >= 40799
26 namespace KokkosKernels {
32 class ArithTraits< Sacado::MP::Vector<S> > {
38 typedef ArithTraits<base_value_type>
BAT;
40 #ifdef HAVE_STOKHOS_ENSEMBLE_REDUCT
41 typedef typename BAT::mag_type
mag_type;
46 static const bool is_specialized =
true;
47 static const bool is_signed = BAT::is_signed;
48 static const bool is_integer = BAT::is_integer;
49 static const bool is_exact = BAT::is_exact;
50 static const bool is_complex = BAT::is_complex;
55 res = res || BAT::isInf(x.fastAccessCoeff(i));
61 res = res || BAT::isInf(x.fastAccessCoeff(i));
66 #ifdef HAVE_STOKHOS_ENSEMBLE_REDUCT
69 n +=
BAT::abs( x.fastAccessCoeff(i) );
73 n.fastAccessCoeff(i) =
BAT::abs( x.fastAccessCoeff(i) );
93 y.fastAccessCoeff(i) = BAT::real(x.fastAccessCoeff(i));
100 y.fastAccessCoeff(i) = BAT::imag(x.fastAccessCoeff(i));
107 y.fastAccessCoeff(i) = BAT::conj(x.fastAccessCoeff(i));
127 return BAT::epsilon();
134 typedef typename Sacado::mpl::apply<S,ordinal_type,base_half_precision>::type
half_storage;
135 typedef typename Sacado::mpl::apply<S,ordinal_type,base_double_precision>::type
double_storage;
138 static const bool isComplex = is_complex;
139 static const bool isOrdinal = is_integer;
140 static const bool isComparable = BAT::isComparable;
141 static const bool hasMachineParameters = BAT::hasMachineParameters;
143 return isNan (x) || isInf (x);
152 return Sacado::StringName<val_type>::eval();
163 static KOKKOS_FORCEINLINE_FUNCTION
int base () {
169 static KOKKOS_FORCEINLINE_FUNCTION
int t () {
175 static KOKKOS_FORCEINLINE_FUNCTION
int emin () {
181 static KOKKOS_FORCEINLINE_FUNCTION
int emax () {
191 namespace KokkosBatched {
193 template <
typename S>
194 struct MagnitudeScalarType< Sacado::MP::Vector<S> > {
196 #if KOKKOS_VERSION >= 40799
197 typedef typename KokkosKernels::ArithTraits<val_type>::mag_type
type;
199 typedef typename Kokkos::ArithTraits<val_type>::mag_type
type;
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
static KOKKOS_FORCEINLINE_FUNCTION mag_type magnitude(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION val_type conjugate(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION mag_type eps()
static KOKKOS_FORCEINLINE_FUNCTION mag_type abs(const val_type &x)
Sacado::MP::Vector< half_storage > halfPrecision
static KOKKOS_FORCEINLINE_FUNCTION val_type pow(const val_type &x, const val_type &y)
static KOKKOS_FORCEINLINE_FUNCTION val_type real(const val_type &x)
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
static KOKKOS_FORCEINLINE_FUNCTION val_type sqrt(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION val_type log10(const val_type &x)
static bool isnaninf(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION mag_type epsilon()
static KOKKOS_FORCEINLINE_FUNCTION val_type one()
Sacado::MP::Vector< S > val_type
static KOKKOS_FORCEINLINE_FUNCTION mag_type rmin()
Sacado::MP::Vector< double_storage > doublePrecision
static KOKKOS_FORCEINLINE_FUNCTION val_type zero()
BAT::halfPrecision base_half_precision
KOKKOS_INLINE_FUNCTION PCE< Storage > min(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
static KOKKOS_FORCEINLINE_FUNCTION mag_type sfmin()
static KOKKOS_FORCEINLINE_FUNCTION val_type max()
static KOKKOS_FORCEINLINE_FUNCTION val_type min()
static KOKKOS_FORCEINLINE_FUNCTION val_type nan()
static std::string name()
KOKKOS_INLINE_FUNCTION PCE< Storage > max(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
static KOKKOS_FORCEINLINE_FUNCTION int emin()
Sacado::mpl::apply< S, ordinal_type, base_double_precision >::type double_storage
static KOKKOS_FORCEINLINE_FUNCTION int t()
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
static KOKKOS_FORCEINLINE_FUNCTION bool isNan(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION int base()
Sacado::Random< double > rnd
BAT::doublePrecision base_double_precision
Sacado::MP::Vector< S > val_type
val_type::value_type base_value_type
static KOKKOS_FORCEINLINE_FUNCTION mag_type rmax()
static KOKKOS_FORCEINLINE_FUNCTION val_type squareroot(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION val_type log(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION val_type conj(const val_type &x)
val_type::ordinal_type ordinal_type
static KOKKOS_FORCEINLINE_FUNCTION mag_type prec()
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
static KOKKOS_FORCEINLINE_FUNCTION mag_type rnd()
static KOKKOS_FORCEINLINE_FUNCTION bool isInf(const val_type &x)
Kokkos::ArithTraits< val_type >::mag_type type
static KOKKOS_FORCEINLINE_FUNCTION int emax()
ArithTraits< base_value_type > BAT
Sacado::mpl::apply< S, ordinal_type, base_half_precision >::type half_storage
static KOKKOS_FORCEINLINE_FUNCTION val_type imag(const val_type &x)