16 #ifndef dealii_differentiation_ad_sacado_math_h 17 #define dealii_differentiation_ad_sacado_math_h 19 #include <deal.II/base/config.h> 21 #ifdef DEAL_II_WITH_TRILINOS 23 #include <deal.II/base/numbers.h> 24 #include <deal.II/differentiation/ad/ad_number_traits.h> 25 #include <deal.II/differentiation/ad/sacado_number_types.h> 39 template<
typename ADNumberType,
typename =
typename std::enable_if<
43 inline ADNumberType erf(ADNumberType x)
57 const double a1 = 0.254829592;
58 const double a2 = -0.284496736;
59 const double a3 = 1.421413741;
60 const double a4 = -1.453152027;
61 const double a5 = 1.061405429;
62 const double p = 0.3275911;
65 const bool neg_val = (x < ::internal::NumberType<ADNumberType>::value(0.0) ? true :
false);
69 const ADNumberType t = 1.0/(1.0 + p*x);
70 const ADNumberType y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*std::exp(-x*x);
82 template<
typename ADNumberType,
typename =
typename std::enable_if<
85 inline ADNumberType erfc(
const ADNumberType &x)
87 return 1.0 - std::erf(x);
94 #endif // DEAL_II_WITH_TRILINOS