15#ifndef dealii_numbers_h
16#define dealii_numbers_h
23#include <Kokkos_Macros.hpp>
30#define DEAL_II_HOST_DEVICE KOKKOS_FUNCTION
31#define DEAL_II_HOST_DEVICE_ALWAYS_INLINE KOKKOS_FORCEINLINE_FUNCTION
37#if (defined(__clang__) && defined(__CUDA__)) || defined(KOKKOS_ENABLE_HIP)
38# define DEAL_II_HOST __host__
45#ifdef DEAL_II_WITH_ADOLC
73 template <
typename Number>
95#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512
97#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256
99#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128
119#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ALTIVEC__)
121#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__)
123#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__)
125#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__)
127#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ARM_NEON)
139template <
typename Number,
147#ifdef DEAL_II_WITH_ADOLC
162abs(
const adouble &x);
165abs(
const adtl::adouble &x);
173 template <
typename Number, std::
size_t w
idth>
174 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
175 sqrt(const ::VectorizedArray<Number, width> &);
176 template <
typename Number, std::
size_t w
idth>
177 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
178 abs(const ::VectorizedArray<Number, width> &);
179 template <
typename Number, std::
size_t w
idth>
180 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
181 max(const ::VectorizedArray<Number, width> &,
182 const ::VectorizedArray<Number, width> &);
183 template <
typename Number, std::
size_t w
idth>
184 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
185 min(const ::VectorizedArray<Number, width> &,
186 const ::VectorizedArray<Number, width> &);
187 template <
typename Number,
size_t w
idth>
189 pow(const ::VectorizedArray<Number, width> &,
const Number p);
190 template <
typename Number,
size_t w
idth>
192 sin(const ::VectorizedArray<Number, width> &);
193 template <
typename Number,
size_t w
idth>
195 cos(const ::VectorizedArray<Number, width> &);
196 template <
typename Number,
size_t w
idth>
198 tan(const ::VectorizedArray<Number, width> &);
199 template <
typename Number,
size_t w
idth>
201 exp(const ::VectorizedArray<Number, width> &);
202 template <
typename Number,
size_t w
idth>
204 log(const ::VectorizedArray<Number, width> &);
229 static constexpr double E = 2.7182818284590452354;
234 static constexpr double LOG2E = 1.4426950408889634074;
239 static constexpr double LOG10E = 0.43429448190325182765;
244 static constexpr double LN2 = 0.69314718055994530942;
249 static constexpr double LN10 = 2.30258509299404568402;
254 static constexpr double PI = 3.14159265358979323846;
259 static constexpr double PI_2 = 1.57079632679489661923;
264 static constexpr double PI_4 = 0.78539816339744830962;
269 static constexpr double SQRT2 = 1.41421356237309504880;
274 static constexpr double SQRT1_2 = 0.70710678118654752440;
293 is_finite(
const std::complex<double> &x);
311 is_finite(
const std::complex<long double> &x);
323 template <
typename Number1,
typename Number2>
337 template <
typename Number1,
typename Number2>
348 template <
typename Number>
362 template <
typename Number1,
typename Number2>
376 template <
typename Number1,
typename Number2>
379 const Number2 &value_2);
393 template <
typename Number1,
typename Number2>
407 template <
typename Number1,
typename Number2>
410 const Number2 &value_2);
420 template <
typename number>
476 template <
typename number>
502 static constexpr std::complex<number>
503 conjugate(
const std::complex<number> &x);
519 abs(
const std::complex<number> &x);
527 return std::isnan(x);
535 return std::isfinite(x);
568 template <
typename number>
577 template <
typename number>
586 template <
typename number>
592#ifdef DEAL_II_WITH_ADOLC
604 template <
typename number>
605 constexpr std::complex<number>
613 template <
typename number>
619#ifdef DEAL_II_WITH_ADOLC
628 template <
typename number>
646 template <
typename T>
651 template <
typename NumberType>
663 template <
typename From,
typename To>
668 template <
typename T>
671 template <
typename F,
typename T>
672 static constexpr auto
673 test(
int) ->
decltype(
f(
static_cast<T
>(std::declval<F>())),
true)
678 template <
typename F,
typename T>
679 static constexpr auto
686 static const bool value = test<From, To>(0);
693 template <
typename T>
710 template <
typename F>
713 std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::decay_t<F>> &&
714 std::is_constructible_v<T, F>> * =
nullptr)
720 template <
typename F>
723 std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::decay_t<F>> &&
724 !std::is_constructible_v<T, F> &&
728 return static_cast<T
>(f);
735 template <
typename F>
739 std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::decay_t<F>> &&
740 !std::is_constructible_v<T, F> &&
748 template <
typename T>
751 static constexpr const std::complex<T> &
757 static constexpr std::complex<T>
760 return std::complex<T>(t);
764 template <
typename U>
765 static constexpr std::complex<T>
777#ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
804 template <
typename Number>
824 template <
typename Number>
859 template <
typename Number>
880 template <
typename Number>
892 template <
typename Number1,
typename Number2>
900 template <
typename Number1,
typename Number2>
901 inline constexpr bool
908 template <
typename Number>
916 template <
typename Number1,
typename Number2>
924 template <
typename Number1,
typename Number2>
933 template <
typename Number1,
typename Number2>
941 template <
typename Number1,
typename Number2>
944 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)
constexpr bool values_are_not_equal(const Number1 &value_1, const Number2 &value_2)
static constexpr double SQRT2
constexpr bool value_is_zero(const Number &value)
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 > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, 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 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 T value(const F &f, std::enable_if_t<!std::is_same_v< std::decay_t< T >, std::decay_t< F > > &&std::is_constructible_v< T, F > > *=nullptr)
static constexpr const T & value(const T &t)
static constexpr T value(const F &f, std::enable_if_t<!std::is_same_v< std::decay_t< T >, std::decay_t< F > > &&!std::is_constructible_v< T, F > &&is_explicitly_convertible< const F, T >::value > *=nullptr)
static T value(const F &f, std::enable_if_t<!std::is_same_v< std::decay_t< T >, std::decay_t< F > > &&!std::is_constructible_v< T, F > &&!is_explicitly_convertible< const F, T >::value &&Differentiation::AD::is_ad_number< F >::value > *=nullptr)
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)