Automatic Differentiation
 
Loading...
Searching...
No Matches
adjoint_of.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_ADJOINT_OF_HPP
2#define STAN_MATH_REV_FUN_ADJOINT_OF_HPP
3
5
6namespace stan {
7namespace math {
8
9namespace internal {
11 template <typename T>
13 return *this;
14 }
15 template <typename T>
17 throw std::runtime_error(
18 "internal::nonexisting_adjoint::operator+= should never be called! "
19 "Please file a bug report.");
20 }
21 template <typename T>
23 throw std::runtime_error(
24 "internal::nonexisting_adjoint::operator-= should never be called! "
25 "Please file a bug report.");
26 }
27};
28} // namespace internal
29
36template <typename T, require_var_t<T>* = nullptr>
37auto& adjoint_of(const T& x) {
38 return x.adj();
39}
40
49template <typename T, require_not_var_t<T>* = nullptr>
51 return {};
52}
53
54} // namespace math
55} // namespace stan
56
57#endif // ADJOINT_OF_HPP
auto & adjoint_of(const T &x)
Returns a reference to a variable's adjoint.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9
nonexisting_adjoint operator+(const T &)