10 #ifndef SACADO_FAD_EXP_MATHFUNCTIONS_HPP
11 #define SACADO_FAD_EXP_MATHFUNCTIONS_HPP
20 #define UNARYFUNC_MACRO(OP,FADOP) \
25 template <typename T> class Expr; \
26 template <typename T> \
27 SACADO_INLINE_FUNCTION \
28 FADOP< typename Expr<T>::derived_type, \
29 typename T::expr_spec_type > \
30 OP (const Expr<T>&); \
37 using Sacado::Fad::Exp::OP; \
61 #undef UNARYFUNC_MACRO
63 #define BINARYFUNC_MACRO(OP,FADOP) \
68 template <typename T> class Expr; \
69 template <typename T> struct IsFadExpr; \
70 template <typename T> struct ExprLevel; \
71 template <typename T1, typename T2> \
72 SACADO_INLINE_FUNCTION \
73 SACADO_FAD_EXP_OP_ENABLE_EXPR_EXPR(FADOP) \
74 OP (const T1&, const T2&); \
76 template <typename T> \
77 SACADO_INLINE_FUNCTION \
78 FADOP< typename T::value_type, typename Expr<T>::derived_type, \
79 true, false, typename T::expr_spec_type > \
80 OP (const typename T::value_type&, const Expr<T>&); \
82 template <typename T> \
83 SACADO_INLINE_FUNCTION \
84 FADOP< typename Expr<T>::derived_type, typename T::value_type, \
85 false, true, typename T::expr_spec_type > \
86 OP (const Expr<T>&, const typename T::value_type&); \
88 template <typename T> \
89 SACADO_INLINE_FUNCTION \
90 SACADO_FAD_EXP_OP_ENABLE_SCALAR_EXPR(FADOP) \
91 OP (const typename T::scalar_type&, const Expr<T>&); \
93 template <typename T> \
94 SACADO_INLINE_FUNCTION \
95 SACADO_FAD_EXP_OP_ENABLE_EXPR_SCALAR(FADOP) \
96 OP (const Expr<T>&, const typename T::scalar_type&); \
103 using Sacado::Fad::Exp::OP; \
111 #undef BINARYFUNC_MACRO
113 #if defined(HAVE_SACADO_KOKKOS)
118 template <
typename S>
class GeneralFad;
119 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U>
122 template <
typename S>
124 void atomic_add(GeneralFad<S>* dst,
const GeneralFad<S>&
x);
125 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
127 void atomic_add(ViewFadPtr<ValT,sl,ss,U> dst,
const Expr<T>& x);
129 template <
typename S>
131 atomic_max_fetch(GeneralFad<S>* dest,
const GeneralFad<S>&
val);
132 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
134 atomic_max_fetch(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
135 template <
typename S>
137 atomic_min_fetch(GeneralFad<S>* dest,
const GeneralFad<S>& val);
138 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
140 atomic_min_fetch(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
141 template <
typename S>
143 atomic_add_fetch(GeneralFad<S>* dst,
const GeneralFad<S>& x);
144 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
146 atomic_add_fetch(ViewFadPtr<ValT,sl,ss,U> dst,
const Expr<T>& x);
147 template <
typename S>
149 atomic_sub_fetch(GeneralFad<S>* dest,
const GeneralFad<S>& val);
150 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
152 atomic_sub_fetch(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
153 template <
typename S>
155 atomic_mul_fetch(GeneralFad<S>* dest,
const GeneralFad<S>& val);
156 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
158 atomic_mul_fetch(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
159 template <
typename S>
161 atomic_div_fetch(GeneralFad<S>* dest,
const GeneralFad<S>& val);
162 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
164 atomic_div_fetch(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
166 template <
typename S>
168 atomic_fetch_max(GeneralFad<S>* dest,
const GeneralFad<S>& val);
169 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
171 atomic_fetch_max(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
172 template <
typename S>
174 atomic_fetch_min(GeneralFad<S>* dest,
const GeneralFad<S>& val);
175 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
177 atomic_fetch_min(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
178 template <
typename S>
180 atomic_fetch_add(GeneralFad<S>* dst,
const GeneralFad<S>& x);
181 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
183 atomic_fetch_add(ViewFadPtr<ValT,sl,ss,U> dst,
const Expr<T>& x);
184 template <
typename S>
186 atomic_fetch_sub(GeneralFad<S>* dest,
const GeneralFad<S>& val);
187 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
189 atomic_fetch_sub(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
190 template <
typename S>
192 atomic_fetch_mul(GeneralFad<S>* dest,
const GeneralFad<S>& val);
193 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
195 atomic_fetch_mul(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
196 template <
typename S>
198 atomic_fetch_div(GeneralFad<S>* dest,
const GeneralFad<S>& val);
199 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
201 atomic_fetch_div(ViewFadPtr<ValT,sl,ss,U> dest,
const Expr<T>& val);
207 using Sacado::Fad::Exp::atomic_add;
208 using Sacado::Fad::Exp::atomic_max_fetch;
209 using Sacado::Fad::Exp::atomic_min_fetch;
210 using Sacado::Fad::Exp::atomic_add_fetch;
211 using Sacado::Fad::Exp::atomic_sub_fetch;
212 using Sacado::Fad::Exp::atomic_mul_fetch;
213 using Sacado::Fad::Exp::atomic_div_fetch;
214 using Sacado::Fad::Exp::atomic_fetch_max;
215 using Sacado::Fad::Exp::atomic_fetch_min;
216 using Sacado::Fad::Exp::atomic_fetch_add;
217 using Sacado::Fad::Exp::atomic_fetch_sub;
218 using Sacado::Fad::Exp::atomic_fetch_mul;
219 using Sacado::Fad::Exp::atomic_fetch_div;
224 #endif // SACADO_FAD_EXP_MATHFUNCTIONS_HPP
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
#define BINARYFUNC_MACRO(OP, FADOP)
expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 expr1 expr1 c *expr2 expr1 c *expr2 expr1 c *expr2 expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 Atan2Op
#define UNARYFUNC_MACRO(OP, FADOP)
SimpleFad< ValueT > min(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
atan2(expr1.val(), expr2.val())
SACADO_INLINE_FUNCTION T safe_sqrt(const T &x)
SimpleFad< ValueT > max(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
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)
#define SACADO_INLINE_FUNCTION
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 PowerOp