Automatic Differentiation
 
Loading...
Searching...
No Matches
ref_type.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_REF_TYPE_HPP
2#define STAN_MATH_PRIM_META_REF_TYPE_HPP
3
11#include <type_traits>
12
13namespace stan {
14
26template <bool Condition, typename T, typename = void>
28 using type = std::conditional_t<std::is_rvalue_reference<T>::value,
29 std::remove_reference_t<T>, const T&>;
30};
31
32template <bool Condition, typename T>
34 Condition, T,
38 = std::conditional_t<std::is_rvalue_reference<T>::value,
39 std::remove_reference_t<T>, const T&>;
40 using T_dec = std::decay_t<decltype(std::declval<T>().derived())>;
41
42 using type = std::conditional_t<
43 Eigen::internal::traits<Eigen::Ref<std::decay_t<T_plain>>>::
44 template match<T_dec>::MatchAtCompileTime
45 || !Condition,
47};
48
49template <bool Condition, typename T>
50struct ref_type_if<Condition, T, require_arena_matrix_t<T>> {
51 using type =
53};
54
55template <typename T>
57
58template <bool Condition, typename T>
60
61template <typename T>
63 typename ref_type_if<is_autodiff_v<T>, T>::type;
64
65} // namespace stan
66
67#endif
require_t< is_arena_matrix< std::decay_t< T > > > require_arena_matrix_t
Require type satisfies is_arena_matrix.
std::integral_constant< bool, B > bool_constant
Alias for structs used for wraps a static constant of bool.
typename ref_type_if< is_autodiff_v< T >, T >::type ref_type_if_not_constant_t
Definition ref_type.hpp:63
typename ref_type_if< Condition, T >::type ref_type_if_t
Definition ref_type.hpp:59
typename ref_type_if< true, T >::type ref_type_t
Definition ref_type.hpp:56
typename plain_type< std::decay_t< T > >::type plain_type_t
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 ...
Defines a static member named value which is defined to be true if the type is arena_matrix<T>
Check if type derives from EigenBase
Definition is_eigen.hpp:21
std::conditional_t< Eigen::internal::traits< Eigen::Ref< std::decay_t< T_plain > > >::template match< T_dec >::MatchAtCompileTime||!Condition, T_optionally_ref, T_plain > type
Definition ref_type.hpp:46
std::conditional_t< std::is_rvalue_reference< T >::value, std::remove_reference_t< T >, const T & > T_optionally_ref
Definition ref_type.hpp:39
typename ref_type_if< Condition, typename std::decay_t< T >::Base >::type type
Definition ref_type.hpp:52
std::conditional_t< std::is_rvalue_reference< T >::value, std::remove_reference_t< T >, const T & > type
Definition ref_type.hpp:29
If the condition is true determines appropriate type for assigning expression of given type to,...
Definition ref_type.hpp:27