Automatic Differentiation
 
Loading...
Searching...
No Matches
is_complex.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_IS_COMPLEX_HPP
2#define STAN_MATH_PRIM_META_IS_COMPLEX_HPP
3
10
11#include <complex>
12#include <type_traits>
13
14namespace stan {
15namespace internal {
16
24template <typename T>
25struct is_complex_impl : std::false_type {};
26
27template <typename... Ts>
28struct is_complex_impl<std::complex<Ts...>> : std::true_type {};
29
30} // namespace internal
31
41template <typename T, typename = void>
42struct is_complex : std::false_type {};
43
44template <typename T>
46 T, std::enable_if_t<internal::is_complex_impl<std::decay_t<T>>::value>>
47 : std::true_type {};
48
56template <typename T>
57struct scalar_type<T, std::enable_if_t<is_complex<T>::value>> {
58 using type = std::complex<typename std::decay_t<T>::value_type>;
59};
60
68template <typename T>
69struct base_type<T, std::enable_if_t<is_complex<T>::value>> {
71};
72
82template <typename T, typename = void>
83struct is_complex_arithmetic : std::false_type {};
84
85template <typename T>
87 T, std::enable_if_t<stan::math::conjunction<
88 std::is_arithmetic<base_type_t<T>>,
89 internal::is_complex_impl<std::decay_t<T>>>::value>>
90 : std::true_type {};
91
101template <typename T, typename = void>
102struct is_complex_ad : std::false_type {};
103
104template <typename T>
105struct is_complex_ad<T, std::enable_if_t<stan::math::conjunction<
106 is_autodiff<base_type_t<T>>,
107 internal::is_complex_impl<std::decay_t<T>>>::value>>
108 : std::true_type {};
109
117template <typename T>
119
122template <typename T>
124
127template <typename... Types>
129
132template <typename... Types>
134
137template <typename... Types>
148template <typename T>
150
153template <typename T>
156
159template <typename T>
162
168template <template <class...> class TypeCheck, class Check>
170 = require_all_t<is_complex<Check>, TypeCheck<base_type_t<Check>>>;
171
183template <typename T>
184struct is_vt_complex : is_complex<value_type_t<std::decay_t<T>>> {};
185
195template <typename T>
197 : bool_constant<!is_complex<value_type_t<std::decay_t<T>>>::value> {};
198
199} // namespace stan
200
201#endif
require_all_t< is_complex< Check >, TypeCheck< base_type_t< Check > > > require_complex_bt
Require type satisfies is_eigen.
require_all_t< is_complex< std::decay_t< Types > >... > require_all_complex_t
Require all of the types satisfy is_complex.
require_not_t< is_complex< std::decay_t< T > > > require_not_complex_t
Require type does not satisfy is_complex.
require_all_not_t< is_complex< std::decay_t< Types > >... > require_all_not_complex_t
Require none of the types satisfy is_complex.
require_not_t< is_complex< value_type_t< std::decay_t< T > > > > require_not_vt_complex
Require value type does not satisfy is_complex.
require_t< is_complex< std::decay_t< T > > > require_complex_t
Require type satisfies is_complex.
require_any_t< is_complex< std::decay_t< Types > >... > require_any_complex_t
Require any of the types satisfy is_complex.
require_t< is_complex< value_type_t< std::decay_t< T > > > > require_vt_complex
Require value type satisfies is_complex.
require_not_t< is_complex< scalar_type_t< std::decay_t< T > > > > require_not_st_complex
Require scalar type does not satisfy is_complex.
std::enable_if_t<!Check::value > require_not_t
If condition is false, template is disabled.
std::enable_if_t< math::disjunction< Checks... >::value > require_any_t
If any condition is true, template is enabled.
std::enable_if_t<!math::disjunction< Checks... >::value > require_all_not_t
If all conditions are false, template is enabled.
typename base_type< T >::type base_type_t
Definition base_type.hpp:29
std::enable_if_t< Check::value > require_t
If condition is true, template is enabled.
std::enable_if_t< math::conjunction< Checks... >::value > require_all_t
If all conditions are true, template is enabled Returns a type void if all conditions are true and ot...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
STL namespace.
base_type_t< typename std::decay_t< T >::value_type > type
Metaprogram structure to determine the base base type of a template argument.
Definition base_type.hpp:24
Provides a member constant value which is equal to true if T is an instance of std::complex and false...
If T is a complex type with an inner autodiff type (that is, an instance of std::complex<var> or std:...
If T is a complex type with an inner arithmetic type (that is, an instance of std::complex<Arithmetic...
If T is a complex type (that is, an instance of std::complex) or a cv-qualified version thereof,...
If the value_type of the type T is of type std::complex or a cv-qualified version thereof,...
If the value_type of the type T is not of type std::complex or a cv-qualified version thereof,...
std::complex< typename std::decay_t< T >::value_type > type
Metaprogram structure to determine the base scalar type of a template argument.