Automatic Differentiation
 
Loading...
Searching...
No Matches
acosh.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_ACOSH_HPP
2#define STAN_MATH_REV_FUN_ACOSH_HPP
3
18#include <cmath>
19#include <complex>
20
21namespace stan {
22namespace math {
23
63inline var acosh(const var& x) {
64 return make_callback_var(acosh(x.val()), [x](const auto& vi) mutable {
65 x.adj() += vi.adj() / std::sqrt(x.val() * x.val() - 1.0);
66 });
67}
77template <typename VarMat, require_var_matrix_t<VarMat>* = nullptr>
78inline auto acosh(const VarMat& x) {
79 return make_callback_var(
80 x.val().unaryExpr([](const auto x) { return acosh(x); }),
81 [x](const auto& vi) mutable {
82 x.adj().array()
83 += vi.adj().array() / (x.val().array().square() - 1.0).sqrt();
84 });
85}
86
93inline std::complex<var> acosh(const std::complex<var>& z) {
95}
96
97} // namespace math
98} // namespace stan
99#endif
std::complex< V > complex_acosh(const std::complex< V > &z)
Return the hyperbolic arc cosine of the complex argument.
Definition acosh.hpp:103
fvar< T > acosh(const fvar< T > &x)
Definition acosh.hpp:16
var_value< plain_type_t< T > > make_callback_var(T &&value, F &&functor)
Creates a new var initialized with a callback_vari with a given value and reverse-pass callback funct...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...