Automatic Differentiation
 
Loading...
Searching...
No Matches
atanh.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_ATANH_HPP
2#define STAN_MATH_REV_FUN_ATANH_HPP
3
13#include <cmath>
14#include <complex>
15
16namespace stan {
17namespace math {
18
58inline var atanh(const var& x) {
59 return make_callback_var(atanh(x.val()), [x](const auto& vi) mutable {
60 x.adj() += vi.adj() / (1.0 - x.val() * x.val());
61 });
62}
63
72template <typename VarMat, require_var_matrix_t<VarMat>* = nullptr>
73inline auto atanh(const VarMat& x) {
74 return make_callback_var(
75 x.val().unaryExpr([](const auto x) { return atanh(x); }),
76 [x](const auto& vi) mutable {
77 x.adj().array() += vi.adj().array() / (1.0 - x.val().array().square());
78 });
79}
80
87inline std::complex<var> atanh(const std::complex<var>& z) {
89}
90
91} // namespace math
92} // namespace stan
93#endif
std::complex< V > complex_atanh(const std::complex< V > &z)
Return the hyperbolic arc tangent of the complex argument.
Definition atanh.hpp:91
fvar< T > atanh(const fvar< T > &x)
Return inverse hyperbolic tangent of specified value.
Definition atanh.hpp:24
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 ...