16#ifndef dealii_numbers_h
17#define dealii_numbers_h
24#ifdef DEAL_II_WITH_CUDA
25# include <cuComplex.h>
28#include <Kokkos_Macros.hpp>
35#define DEAL_II_HOST_DEVICE KOKKOS_FUNCTION
36#define DEAL_II_CUDA_HOST_DEV DEAL_II_HOST_DEVICE
37#define DEAL_II_HOST_DEVICE_ALWAYS_INLINE KOKKOS_FORCEINLINE_FUNCTION
44#if defined(__clang__) && defined(__CUDA__)
45# define DEAL_II_HOST __host__
52#ifdef DEAL_II_WITH_ADOLC
80 template <
typename Number>
102#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512
104#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256
106#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128
126#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ALTIVEC__)
128#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__)
130#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__)
132#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__)
144template <
typename Number,
152#ifdef DEAL_II_WITH_ADOLC
167abs(
const adouble &x);
170abs(
const adtl::adouble &x);
178 template <
typename Number, std::
size_t w
idth>
179 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
180 sqrt(const ::VectorizedArray<Number, width> &);
181 template <
typename Number, std::
size_t w
idth>
182 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
183 abs(const ::VectorizedArray<Number, width> &);
184 template <
typename Number, std::
size_t w
idth>
185 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
186 max(const ::VectorizedArray<Number, width> &,
187 const ::VectorizedArray<Number, width> &);
188 template <
typename Number, std::
size_t w
idth>
189 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
190 min(const ::VectorizedArray<Number, width> &,
191 const ::VectorizedArray<Number, width> &);
192 template <
typename Number,
size_t w
idth>
194 pow(const ::VectorizedArray<Number, width> &,
const Number p);
195 template <
typename Number,
size_t w
idth>
197 sin(const ::VectorizedArray<Number, width> &);
198 template <
typename Number,
size_t w
idth>
200 cos(const ::VectorizedArray<Number, width> &);
201 template <
typename Number,
size_t w
idth>
203 tan(const ::VectorizedArray<Number, width> &);
204 template <
typename Number,
size_t w
idth>
206 exp(const ::VectorizedArray<Number, width> &);
207 template <
typename Number,
size_t w
idth>
209 log(const ::VectorizedArray<Number, width> &);
234 static constexpr double E = 2.7182818284590452354;
239 static constexpr double LOG2E = 1.4426950408889634074;
244 static constexpr double LOG10E = 0.43429448190325182765;
249 static constexpr double LN2 = 0.69314718055994530942;
254 static constexpr double LN10 = 2.30258509299404568402;
259 static constexpr double PI = 3.14159265358979323846;
264 static constexpr double PI_2 = 1.57079632679489661923;
269 static constexpr double PI_4 = 0.78539816339744830962;
274 static constexpr double SQRT2 = 1.41421356237309504880;
279 static constexpr double SQRT1_2 = 0.70710678118654752440;
298 is_finite(
const std::complex<double> &x);
316 is_finite(
const std::complex<long double> &x);
328 template <
typename Number1,
typename Number2>
342 template <
typename Number1,
typename Number2>
353 template <
typename Number>
367 template <
typename Number1,
typename Number2>
381 template <
typename Number1,
typename Number2>
384 const Number2 &value_2);
398 template <
typename Number1,
typename Number2>
412 template <
typename Number1,
typename Number2>
415 const Number2 &value_2);
425 template <
typename number>
481 template <
typename number>
507 static constexpr std::complex<number>
508 conjugate(
const std::complex<number> &x);
524 abs(
const std::complex<number> &x);
532 return std::isnan(x);
540 return std::isfinite(x);
573 template <
typename number>
582 template <
typename number>
591 template <
typename number>
597#ifdef DEAL_II_WITH_ADOLC
609 template <
typename number>
610 constexpr std::complex<number>
618 template <
typename number>
624#ifdef DEAL_II_WITH_ADOLC
633 template <
typename number>
651 template <
typename T>
656 template <
typename NumberType>
668 template <
typename From,
typename To>
673 template <
typename T>
676 template <
typename F,
typename T>
677 static constexpr auto
678 test(
int) ->
decltype(
f(
static_cast<T
>(std::declval<F>())),
true)
683 template <
typename F,
typename T>
684 static constexpr auto
691 static bool const value = test<From, To>(0);
698 template <
typename T>
715 template <
typename F>
718 std::enable_if_t<!std::is_same<
typename std::decay<T>::type,
719 typename std::decay<F>::type>
::value &&
720 std::is_constructible<T, F>::value> * =
nullptr)
726 template <
typename F>
729 std::enable_if_t<!std::is_same<
typename std::decay<T>::type,
730 typename std::decay<F>::type>
::value &&
731 !std::is_constructible<T, F>::value &&
735 return static_cast<T
>(f);
742 template <
typename F>
746 std::enable_if_t<!std::is_same<
typename std::decay<T>::type,
747 typename std::decay<F>::type>
::value &&
748 !std::is_constructible<T, F>::value &&
756 template <
typename T>
759 static constexpr const std::complex<T> &
765 static constexpr std::complex<T>
768 return std::complex<T>(t);
772 template <
typename U>
773 static constexpr std::complex<T>
781#ifdef DEAL_II_WITH_CUDA
788 return make_cuComplex(t, 0.f);
795 static cuDoubleComplex
798 return make_cuDoubleComplex(t, 0.);
806#ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
833 template <
typename Number>
853 template <
typename Number>
888 template <
typename Number>
909 template <
typename Number>
921 template <
typename Number1,
typename Number2>
929 template <
typename Number1,
typename Number2>
937 template <
typename Number>
945 template <
typename Number1,
typename Number2>
953 template <
typename Number1,
typename Number2>
962 template <
typename Number1,
typename Number2>
970 template <
typename Number1,
typename Number2>
973 const Number2 &value_2)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static constexpr double LOG10E
static constexpr double PI_2
bool value_is_less_than_or_equal_to(const Number1 &value_1, const Number2 &value_2)
static constexpr double E
static constexpr double PI
bool value_is_greater_than(const Number1 &value_1, const Number2 &value_2)
static constexpr double SQRT2
constexpr bool value_is_zero(const Number &value)
bool values_are_not_equal(const Number1 &value_1, const Number2 &value_2)
static constexpr double SQRT1_2
constexpr bool values_are_equal(const Number1 &value_1, const Number2 &value_2)
static constexpr double PI_4
static constexpr double LN10
static constexpr double LN2
bool value_is_less_than(const Number1 &value_1, const Number2 &value_2)
bool is_finite(const double x)
static constexpr double LOG2E
bool value_is_greater_than_or_equal_to(const Number1 &value_1, const Number2 &value_2)
bool is_nan(const double x)
::VectorizedArray< Number, width > log(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > tan(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
#define DEAL_II_HOST_DEVICE
#define DEAL_II_HOST_DEVICE_ALWAYS_INLINE
static cuComplex value(const float t)
static cuDoubleComplex value(const double t)
static constexpr std::complex< T > value(const std::complex< U > &t)
static constexpr std::complex< T > value(const T &t)
static constexpr const std::complex< T > & value(const std::complex< T > &t)
static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T value(const F &f, std::enable_if_t<!std::is_same< typename std::decay< T >::type, typename std::decay< F >::type >::value &&!std::is_constructible< T, F >::value &&is_explicitly_convertible< const F, T >::value > *=nullptr)
static T value(const F &f, std::enable_if_t<!std::is_same< typename std::decay< T >::type, typename std::decay< F >::type >::value &&!std::is_constructible< T, F >::value &&!is_explicitly_convertible< const F, T >::value &&Differentiation::AD::is_ad_number< F >::value > *=nullptr)
static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T value(const F &f, std::enable_if_t<!std::is_same< typename std::decay< T >::type, typename std::decay< F >::type >::value &&std::is_constructible< T, F >::value > *=nullptr)
static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE const T & value(const T &t)
static constexpr unsigned int max_width
static constexpr auto test(...) -> bool
static constexpr auto test(int) -> decltype(f(static_cast< T >(std::declval< F >())), true)
std::complex< double > double_type
static constexpr const number & conjugate(const number &x)
static constexpr bool is_complex
static real_type abs(const number &x)
static constexpr real_type abs_square(const number &x)