10 #ifndef SACADO_TAY_SCALARTRAITSIMP_HPP
11 #define SACADO_TAY_SCALARTRAITSIMP_HPP
15 #ifdef HAVE_SACADO_TEUCHOSCORE
26 template <
typename TayType>
27 struct ScalarTraitsImp {
30 typedef typename mpl::apply<TayType,typename Teuchos::ScalarTraits<ValueT>::magnitudeType>::type magnitudeType;
31 typedef typename mpl::apply<TayType,typename Teuchos::ScalarTraits<ValueT>::halfPrecision>::type halfPrecision;
32 typedef typename mpl::apply<TayType,typename Teuchos::ScalarTraits<ValueT>::doublePrecision>::type doublePrecision;
36 static const bool isComparable =
38 static const bool hasMachineParameters =
70 static magnitudeType magnitude(
const TayType&
a) {
72 TEUCHOS_SCALAR_TRAITS_NAN_INF_ERR(
73 a,
"Error, the input value to magnitude(...) a = " << a <<
76 "Complex magnitude is not a differentiable "
77 "function of complex inputs.");
80 magnitudeType b(a.degree(),
83 for (
int i=1;
i<=a.degree();
i++)
84 b.fastAccessCoeff(
i) =
87 for (
int i=1;
i<=a.degree();
i++)
88 b.fastAccessCoeff(
i) =
92 static ValueT zero() {
100 static TayType conjugate(
const TayType&
x) {
103 "Complex conjugate is not a differentiable "
104 "function of complex inputs.");
113 static TayType real(
const TayType& x) {
116 "Real component is not a differentiable "
117 "function of complex inputs.");
126 static TayType imag(
const TayType& x) {
129 "Imaginary component is not a differentiable "
130 "function of complex inputs.");
135 static ValueT nan() {
138 static bool isnaninf(
const TayType& x) {
139 for (
int i=0;
i<=x.degree();
i++)
144 static void seedrandom(
unsigned int s) {
147 static ValueT random() {
150 static std::string name() {
153 static TayType squareroot(
const TayType& x) {
155 TEUCHOS_SCALAR_TRAITS_NAN_INF_ERR(
156 x,
"Error, the input value to squareroot(...) a = " << x <<
157 " can not be NaN!" );
161 static TayType
pow(
const TayType& x,
const TayType& y) {
166 static bool is_complex_real(
const ValueT& x) {
172 static bool is_tay_real(
const TayType& x) {
176 for (
int i=0;
i<=x.degree();
i++)
177 if (!is_complex_real(x.fastAccessCoeff(
i)))
189 #endif // HAVE_SACADO_TEUCHOSCORE
191 #endif // SACADO_FAD_SCALARTRAITSIMP_HPP
static std::string eval()
static magnitudeType eps()
PowExprType< Expr< T1 >, Expr< T2 > >::expr_type pow(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static magnitudeType real(T a)
static magnitudeType emax()
static magnitudeType base()
static magnitudeType rmax()
static magnitudeType sfmin()
static magnitudeType prec()
static magnitudeType rmin()
static void seedrandom(unsigned int s)
static magnitudeType magnitude(T a)
Sacado::Random< double > rnd
SACADO_INLINE_FUNCTION mpl::enable_if_c< ExprLevel< Expr< T1 > >::value==ExprLevel< Expr< T2 > >::value, Expr< PowerOp< Expr< T1 >, Expr< T2 > > > >::type pow(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
static magnitudeType emin()
static magnitudeType rnd()