Automatic Differentiation
 
Loading...
Searching...
No Matches
arena_type.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_META_ARENA_TYPE_HPP
2#define STAN_MATH_REV_META_ARENA_TYPE_HPP
3
10
11namespace stan {
12
13namespace internal {
14template <typename T, typename = void, typename = void>
16
17template <typename T>
19 T, require_t<std::is_base_of<stan::math::chainable_alloc, T>>> {
20 using type = T;
21};
22
23template <typename T>
24struct arena_type_impl<T, require_all_t<std::is_trivially_destructible<T>,
25 bool_constant<!is_eigen<T>::value>>> {
26 using type = T;
27};
28
29template <typename T, typename Alloc>
30struct arena_type_impl<std::vector<T, Alloc>> {
31 using T_ad = typename arena_type_impl<std::decay_t<T>>::type;
32 using type = std::vector<T_ad, math::arena_allocator<T_ad>>;
33};
34
35template <typename T>
37 T, require_eigen_t<T>,
38 std::enable_if_t<T::RowsAtCompileTime == Eigen::Dynamic
39 || T::ColsAtCompileTime == Eigen::Dynamic>> {
41};
42
43template <typename T>
45 T, require_eigen_t<T>,
46 std::enable_if_t<T::RowsAtCompileTime != Eigen::Dynamic
47 && T::ColsAtCompileTime != Eigen::Dynamic>> {
49};
50} // namespace internal
51
57template <typename T>
59
60} // namespace stan
61
62#endif
Equivalent to Eigen::Matrix, except that the data is stored on AD stack.
require_t< is_eigen< std::decay_t< T > > > require_eigen_t
Require type satisfies is_eigen.
Definition is_eigen.hpp:110
std::integral_constant< bool, B > bool_constant
Alias for structs used for wraps a static constant of bool.
typename plain_type< T >::type plain_type_t
typename internal::arena_type_impl< std::decay_t< T > >::type arena_t
Determines a type that can be used in place of T that does any dynamic allocations on the AD stack.
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.
typename arena_type_impl< std::decay_t< T > >::type T_ad
std::vector< T_ad, math::arena_allocator< T_ad > > type