Automatic Differentiation
 
Loading...
Searching...
No Matches
is_eigen.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_IS_EIGEN_HPP
2#define STAN_MATH_PRIM_META_IS_EIGEN_HPP
3
9#include <type_traits>
10
11namespace stan {
12
19template <typename T>
21 : bool_constant<is_base_pointer_convertible<Eigen::EigenBase, T>::value> {};
22
23namespace internal {
24// primary template handles types that have no nested ::type member:
25template <class, class = void>
26struct has_internal_trait : std::false_type {};
27
28// specialization recognizes types that do have a nested ::type member:
29template <class T>
31 std::void_t<Eigen::internal::traits<std::decay_t<T>>>>
32 : std::true_type {};
33
34// primary template handles types that have no nested ::type member:
35template <class, class = void>
36struct has_scalar_trait : std::false_type {};
37
38// specialization recognizes types that do have a nested ::type member:
39template <class T>
40struct has_scalar_trait<T, std::void_t<typename std::decay_t<T>::Scalar>>
41 : std::true_type {};
42
43} // namespace internal
44
52template <typename T>
53struct scalar_type<T,
54 std::enable_if_t<is_eigen<T>::value
55 && internal::has_scalar_trait<T>::value>> {
57};
58
66template <typename T>
67struct value_type<T,
68 std::enable_if_t<is_eigen<T>::value
69 && internal::has_scalar_trait<T>::value>> {
70 using type = typename std::decay_t<T>::Scalar;
71};
72
80template <typename T>
81struct scalar_type<T,
82 std::enable_if_t<is_eigen<T>::value
83 && !internal::has_scalar_trait<T>::value>> {
85 typename Eigen::internal::traits<std::decay_t<T>>::Scalar>;
86};
87
95template <typename T>
96struct value_type<T,
97 std::enable_if_t<is_eigen<T>::value
98 && !internal::has_scalar_trait<T>::value>> {
99 using type = typename Eigen::internal::traits<std::decay_t<T>>::Scalar;
100};
101
109template <typename T>
111
114template <typename T>
116
119template <typename... Types>
121
124template <typename... Types>
126
129template <typename... Types>
132
135template <typename... Types>
150template <template <class...> class TypeCheck, class... Check>
152 container_type_check_base<is_eigen, value_type_t, TypeCheck, Check...>>;
153
159template <template <class...> class TypeCheck, class... Check>
161 container_type_check_base<is_eigen, value_type_t, TypeCheck, Check...>>;
162
168template <template <class...> class TypeCheck, class... Check>
171
177template <template <class...> class TypeCheck, class... Check>
180
186template <template <class...> class TypeCheck, class... Check>
189
195template <template <class...> class TypeCheck, class... Check>
198
204template <template <class...> class TypeCheck, class... Check>
206 container_type_check_base<is_eigen, scalar_type_t, TypeCheck, Check...>>;
207
213template <template <class...> class TypeCheck, class... Check>
215 container_type_check_base<is_eigen, scalar_type_t, TypeCheck, Check...>>;
216
222template <template <class...> class TypeCheck, class... Check>
225
231template <template <class...> class TypeCheck, class... Check>
234
240template <template <class...> class TypeCheck, class... Check>
243
249template <template <class...> class TypeCheck, class... Check>
259template <typename T>
261 : bool_constant<is_base_pointer_convertible<Eigen::ArrayBase, T>::value> {};
262
270template <typename T>
272
275template <typename T>
278
281template <typename... Types>
291template <typename T>
294
305template <template <class...> class TypeCheck, class... Check>
308 TypeCheck, Check...>>;
311namespace internal {
312template <typename T>
313struct is_eigen_contiguous_map_impl : std::false_type {};
314template <typename T, int Opts>
315struct is_eigen_contiguous_map_impl<Eigen::Map<T, Opts, Eigen::Stride<0, 0>>>
316 : std::true_type {};
317
318} // namespace internal
319
324template <typename T>
326 : internal::is_eigen_contiguous_map_impl<std::decay_t<T>> {};
327
328} // namespace stan
329#endif
require_any_t< is_eigen_array< std::decay_t< Types > >... > require_any_eigen_array_t
Require any of the types satisfy is_eigen_array.
Definition is_eigen.hpp:283
require_t< container_type_check_base< is_eigen_array, value_type_t, TypeCheck, Check... > > require_eigen_array_vt
Require type satisfies is_eigen_array.
Definition is_eigen.hpp:308
require_t< is_eigen_array< std::decay_t< T > > > require_eigen_array_t
Require type satisfies is_eigen_array.
Definition is_eigen.hpp:271
require_not_t< is_eigen_array< std::decay_t< T > > > require_not_eigen_array_t
Require type does not satisfy is_eigen_array.
Definition is_eigen.hpp:277
require_all_t< container_type_check_base< is_eigen, value_type_t, TypeCheck, Check >... > require_all_eigen_vt
Require all of the types satisfy is_eigen.
Definition is_eigen.hpp:188
require_any_t< is_eigen< std::decay_t< Types > >... > require_any_eigen_t
Require any of the types satisfy is_eigen.
Definition is_eigen.hpp:125
require_any_not_t< container_type_check_base< is_eigen, scalar_type_t, TypeCheck, Check >... > require_any_not_eigen_st
Require at least one of the types does not satisfy is_eigen.
Definition is_eigen.hpp:233
require_t< container_type_check_base< is_eigen, value_type_t, TypeCheck, Check... > > require_eigen_vt
Require type satisfies is_eigen.
Definition is_eigen.hpp:152
require_t< container_type_check_base< is_eigen, scalar_type_t, TypeCheck, Check... > > require_eigen_st
Require type satisfies is_eigen.
Definition is_eigen.hpp:206
require_all_t< is_eigen< std::decay_t< Types > >... > require_all_eigen_t
Require all of the types satisfy is_eigen.
Definition is_eigen.hpp:120
require_t< is_eigen< std::decay_t< T > > > require_eigen_t
Require type satisfies is_eigen.
Definition is_eigen.hpp:110
require_all_not_t< container_type_check_base< is_eigen, scalar_type_t, TypeCheck, Check >... > require_all_not_eigen_st
Require none of the types satisfy is_eigen.
Definition is_eigen.hpp:251
require_all_not_t< is_eigen< std::decay_t< Types > >... > require_all_not_eigen_t
Require none of the types satisfy is_eigen.
Definition is_eigen.hpp:131
require_any_t< container_type_check_base< is_eigen, scalar_type_t, TypeCheck, Check >... > require_any_eigen_st
Require any of the types satisfy is_eigen.
Definition is_eigen.hpp:224
require_not_t< container_type_check_base< is_eigen, value_type_t, TypeCheck, Check... > > require_not_eigen_vt
Require type does not satisfy is_eigen or.
Definition is_eigen.hpp:161
require_all_t< container_type_check_base< is_eigen, scalar_type_t, TypeCheck, Check >... > require_all_eigen_st
Require all of the types does not satisfy is_eigen.
Definition is_eigen.hpp:242
require_not_t< container_type_check_base< is_eigen, scalar_type_t, TypeCheck, Check... > > require_not_eigen_st
Require type does not satisfy is_eigen.
Definition is_eigen.hpp:215
require_not_t< is_eigen< std::decay_t< T > > > require_not_eigen_t
Require type does not satisfy is_eigen.
Definition is_eigen.hpp:115
require_all_not_t< container_type_check_base< is_eigen, value_type_t, TypeCheck, Check >... > require_all_not_eigen_vt
Require none of the types satisfy is_eigen.
Definition is_eigen.hpp:197
require_any_t< container_type_check_base< is_eigen, value_type_t, TypeCheck, Check >... > require_any_eigen_vt
Require any of the types satisfy is_eigen.
Definition is_eigen.hpp:170
require_any_not_t< is_eigen< std::decay_t< Types > >... > require_any_not_eigen_t
Require at least one of the types do not satisfy is_eigen.
Definition is_eigen.hpp:137
require_any_not_t< container_type_check_base< is_eigen, value_type_t, TypeCheck, Check >... > require_any_not_eigen_vt
Require at least one of the types does not satisfy is_eigen.
Definition is_eigen.hpp:179
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
(Expert) Numerical traits for algorithmic differentiation variables.
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.
bool_constant< math::conjunction< ContainerCheck< std::decay_t< Check > >..., TypeCheck< ValueCheck< Check > >... >::value > container_type_check_base
Used as the base for checking whether a type is a container with an underlying scalar type.
typename scalar_type< T >::type scalar_type_t
std::enable_if_t<!math::conjunction< Checks... >::value > require_any_not_t
If any condition is false, template is enabled.
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...
typename make_void< Ts... >::type void_t
Utility metafunction that maps a sequence of any types to the type void This metafunction is used in ...
Definition void_t.hpp:21
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
STL namespace.
Check if a type is derived from Eigen::ArrayBase
Definition is_eigen.hpp:261
Check if a type is an Eigen::Map with contiguous stride.
Definition is_eigen.hpp:326
Check if type derives from EigenBase
Definition is_eigen.hpp:21
Extends std::false_type when instantiated with zero or more template parameters, all of which extend ...
scalar_type_t< typename Eigen::internal::traits< std::decay_t< T > >::Scalar > type
Definition is_eigen.hpp:85
Metaprogram structure to determine the base scalar type of a template argument.
Primary template class for metaprogram to compute the type of values stored in a container.