16#ifndef dealii_numbers_h
17#define dealii_numbers_h
24#ifdef DEAL_II_COMPILER_CUDA_AWARE
25# include <cuComplex.h>
33#ifdef DEAL_II_COMPILER_CUDA_AWARE
34# define DEAL_II_CUDA_HOST_DEV __host__ __device__
36# define DEAL_II_CUDA_HOST_DEV
59 template <
typename Number>
81#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512
83#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256
85#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128
105#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ALTIVEC__)
107#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__)
109#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__)
111#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__)
123template <
typename Number,
135#ifdef DEAL_II_WITH_ADOLC
138# include <adolc/adouble.h>
144#ifdef DEAL_II_TRILINOS_WITH_SACADO
145# include <Sacado.hpp>
150 template <
typename Number, std::
size_t w
idth>
151 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
152 sqrt(const ::VectorizedArray<Number, width> &);
153 template <
typename Number, std::
size_t w
idth>
154 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
155 abs(const ::VectorizedArray<Number, width> &);
156 template <
typename Number, std::
size_t w
idth>
157 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
158 max(const ::VectorizedArray<Number, width> &,
159 const ::VectorizedArray<Number, width> &);
160 template <
typename Number, std::
size_t w
idth>
161 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
162 min(const ::VectorizedArray<Number, width> &,
163 const ::VectorizedArray<Number, width> &);
164 template <
typename Number,
size_t w
idth>
166 pow(const ::VectorizedArray<Number, width> &,
const Number p);
167 template <
typename Number,
size_t w
idth>
169 sin(const ::VectorizedArray<Number, width> &);
170 template <
typename Number,
size_t w
idth>
172 cos(const ::VectorizedArray<Number, width> &);
173 template <
typename Number,
size_t w
idth>
175 tan(const ::VectorizedArray<Number, width> &);
176 template <
typename Number,
size_t w
idth>
178 exp(const ::VectorizedArray<Number, width> &);
179 template <
typename Number,
size_t w
idth>
181 log(const ::VectorizedArray<Number, width> &);
206 static constexpr double E = 2.7182818284590452354;
211 static constexpr double LOG2E = 1.4426950408889634074;
216 static constexpr double LOG10E = 0.43429448190325182765;
221 static constexpr double LN2 = 0.69314718055994530942;
226 static constexpr double LN10 = 2.30258509299404568402;
231 static constexpr double PI = 3.14159265358979323846;
236 static constexpr double PI_2 = 1.57079632679489661923;
241 static constexpr double PI_4 = 0.78539816339744830962;
246 static constexpr double SQRT2 = 1.41421356237309504880;
251 static constexpr double SQRT1_2 = 0.70710678118654752440;
258 template <
typename Number,
typename =
void>
265 template <
typename Number>
286 is_finite(
const std::complex<double> &x);
304 is_finite(
const std::complex<long double> &x);
316 template <
typename Number1,
typename Number2>
330 template <
typename Number1,
typename Number2>
341 template <
typename Number>
355 template <
typename Number1,
typename Number2>
369 template <
typename Number1,
typename Number2>
372 const Number2 &value_2);
386 template <
typename Number1,
typename Number2>
400 template <
typename Number1,
typename Number2>
403 const Number2 &value_2);
413 template <
typename number>
449 template <
typename Dummy = number>
451 typename std::enable_if<std::is_same<Dummy, number>::value &&
456 template <
typename Dummy = number>
458 typename std::enable_if<std::is_same<Dummy, number>::value &&
475 template <
typename number>
496 static constexpr std::complex<number>
497 conjugate(
const std::complex<number> &x);
513 abs(
const std::complex<number> &x);
521 return std::isnan(x);
529 return std::isfinite(x);
562 template <
typename number>
571 template <
typename number>
572 template <
typename Dummy>
574 typename std::enable_if<std::is_same<Dummy, number>::value &&
584 template <
typename number>
585 template <
typename Dummy>
587 typename std::enable_if<std::is_same<Dummy, number>::value &&
597 template <
typename number>
606 template <
typename number>
607 constexpr std::complex<number>
615 template <
typename number>
624 template <
typename number>
642 template <
typename T>
647 template <
typename NumberType>
659 template <
typename From,
typename To>
664 template <
typename T>
667 template <
typename F,
typename T>
668 static constexpr auto
669 test(
int) ->
decltype(
f(
static_cast<T>(std::declval<F>())),
true)
674 template <
typename F,
typename T>
675 static constexpr auto
682 static bool const value = test<From, To>(0);
689 template <
typename T>
706 template <
typename F>
709 typename std::enable_if<
710 !std::is_same<
typename std::decay<T>::type,
711 typename std::decay<F>::type>
::value &&
712 std::is_constructible<T, F>::value>::type * =
nullptr)
718 template <
typename F>
721 typename std::enable_if<
722 !std::is_same<
typename std::decay<T>::type,
723 typename std::decay<F>::type>
::value &&
724 !std::is_constructible<T, F>::value &&
727 return static_cast<T>(f);
734 template <
typename F>
737 typename std::enable_if<
738 !std::is_same<
typename std::decay<T>::type,
739 typename std::decay<F>::type>
::value &&
740 !std::is_constructible<T, F>::value &&
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>
773#ifdef DEAL_II_COMPILER_CUDA_AWARE
780 return make_cuComplex(t, 0.f);
787 static cuDoubleComplex
790 return make_cuDoubleComplex(t, 0.);
798#ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
825 template <
typename Number>
845 template <
typename Number>
880 template <
typename Number>
901 template <
typename Number>
913 template <
typename Number1,
typename Number2>
921 template <
typename Number1,
typename Number2>
929 template <
typename Number>
937 template <
typename Number1,
typename Number2>
945 template <
typename Number1,
typename Number2>
954 template <
typename Number1,
typename Number2>
962 template <
typename Number1,
typename Number2>
965 const Number2 &value_2)
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
Tensor< 2, dim, Number > F(const Tensor< 2, dim, Number > &Grad_u)
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 > 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_CUDA_HOST_DEV
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 T value(const F &f, typename std::enable_if< !std::is_same< typename std::decay< T >::type, typename std::decay< F >::type >::value &&std::is_constructible< T, F >::value >::type *=nullptr)
static constexpr const T & value(const T &t)
static T value(const F &f, typename std::enable_if< !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 >::type *=nullptr)
static constexpr T value(const F &f, typename std::enable_if< !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 >::type *=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)
static constexpr std::enable_if< std::is_same< Dummy, number >::value &&!is_cuda_compatible< Dummy >::value, real_type >::type abs_square(const number &x)
static constexpr const number & conjugate(const number &x)
static constexpr bool is_complex
static constexpr std::enable_if< std::is_same< Dummy, number >::value &&is_cuda_compatible< Dummy >::value, real_type >::type abs_square(const number &x)
static real_type abs(const number &x)