10 #ifndef KOKKOS_ARITHTRAITS_UQ_PCE_HPP
11 #define KOKKOS_ARITHTRAITS_UQ_PCE_HPP
14 #include "Kokkos_ArithTraits.hpp"
15 #include "KokkosBatched_Vector.hpp"
24 class ArithTraits< Sacado::UQ::PCE<S> > {
30 typedef ArithTraits<base_value_type>
BAT;
35 static const bool is_specialized =
true;
36 static const bool is_signed = BAT::is_signed;
37 static const bool is_integer = BAT::is_integer;
38 static const bool is_exact = BAT::is_exact;
39 static const bool is_complex = BAT::is_complex;
44 res = res || BAT::isInf(x.fastAccessCoeff(i));
50 res = res || BAT::isInf(x.fastAccessCoeff(i));
58 n +=
BAT::abs( x.fastAccessCoeff(i) );
77 y.fastAccessCoeff(i) = BAT::real(x.fastAccessCoeff(i));
84 y.fastAccessCoeff(i) = BAT::imag(x.fastAccessCoeff(i));
91 y.fastAccessCoeff(i) = BAT::conj(x.fastAccessCoeff(i));
111 return BAT::epsilon();
118 typedef typename Sacado::mpl::apply<S,ordinal_type,base_half_precision>::type
half_storage;
119 typedef typename Sacado::mpl::apply<S,ordinal_type,base_double_precision>::type
double_storage;
122 static const bool isComplex = is_complex;
123 static const bool isOrdinal = is_integer;
124 static const bool isComparable = BAT::isComparable;
125 static const bool hasMachineParameters = BAT::hasMachineParameters;
127 return isNan (x) || isInf (x);
136 return Sacado::StringName<val_type>::eval();
147 static KOKKOS_FORCEINLINE_FUNCTION
int base () {
153 static KOKKOS_FORCEINLINE_FUNCTION
int t () {
159 static KOKKOS_FORCEINLINE_FUNCTION
int emin () {
165 static KOKKOS_FORCEINLINE_FUNCTION
int emax () {
175 namespace KokkosBatched {
177 template <
typename S>
178 struct MagnitudeScalarType< Sacado::UQ::PCE<S> > {
180 typedef typename Kokkos::ArithTraits<val_type>::mag_type
type;
static bool isnaninf(const val_type &x)
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
static KOKKOS_FORCEINLINE_FUNCTION val_type max()
static KOKKOS_FORCEINLINE_FUNCTION val_type min()
Sacado::UQ::PCE< double_storage > doublePrecision
static KOKKOS_FORCEINLINE_FUNCTION mag_type rmax()
static KOKKOS_FORCEINLINE_FUNCTION mag_type abs(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION val_type log10(const val_type &x)
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
val_type::value_type base_value_type
static KOKKOS_FORCEINLINE_FUNCTION mag_type rmin()
static KOKKOS_FORCEINLINE_FUNCTION val_type one()
static KOKKOS_FORCEINLINE_FUNCTION int base()
ArithTraits< base_value_type > BAT
Sacado::UQ::PCE< S > val_type
Sacado::mpl::apply< S, ordinal_type, base_double_precision >::type double_storage
static KOKKOS_FORCEINLINE_FUNCTION val_type log(const val_type &x)
Kokkos::ArithTraits< val_type >::mag_type type
BAT::halfPrecision base_half_precision
static KOKKOS_FORCEINLINE_FUNCTION mag_type magnitude(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION int emax()
KOKKOS_INLINE_FUNCTION PCE< Storage > min(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
static std::string name()
static KOKKOS_FORCEINLINE_FUNCTION val_type squareroot(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION int t()
static KOKKOS_FORCEINLINE_FUNCTION val_type nan()
static KOKKOS_FORCEINLINE_FUNCTION int emin()
static KOKKOS_FORCEINLINE_FUNCTION mag_type prec()
static KOKKOS_FORCEINLINE_FUNCTION val_type imag(const val_type &x)
Sacado::UQ::PCE< half_storage > halfPrecision
static KOKKOS_FORCEINLINE_FUNCTION mag_type sfmin()
KOKKOS_INLINE_FUNCTION PCE< Storage > max(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
Sacado::UQ::PCE< S > val_type
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
static KOKKOS_FORCEINLINE_FUNCTION mag_type rnd()
static KOKKOS_FORCEINLINE_FUNCTION bool isNan(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION val_type real(const val_type &x)
Sacado::Random< double > rnd
Sacado::mpl::apply< S, ordinal_type, base_half_precision >::type half_storage
static KOKKOS_FORCEINLINE_FUNCTION val_type conjugate(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION val_type pow(const val_type &x, const val_type &y)
static KOKKOS_FORCEINLINE_FUNCTION mag_type eps()
static KOKKOS_FORCEINLINE_FUNCTION bool isInf(const val_type &x)
BAT::doublePrecision base_double_precision
static KOKKOS_FORCEINLINE_FUNCTION val_type conj(const val_type &x)
val_type::ordinal_type ordinal_type
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
static KOKKOS_FORCEINLINE_FUNCTION val_type zero()
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
static KOKKOS_FORCEINLINE_FUNCTION val_type sqrt(const val_type &x)
static KOKKOS_FORCEINLINE_FUNCTION mag_type epsilon()