Automatic Differentiation
 
Loading...
Searching...
No Matches
asinh.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_ASINH_HPP
2#define STAN_MATH_REV_FUN_ASINH_HPP
3
20#include <cmath>
21#include <complex>
22
23namespace stan {
24namespace math {
25
59inline var asinh(const var& x) {
60 return make_callback_var(std::asinh(x.val()), [x](const auto& vi) mutable {
61 x.adj() += vi.adj() / std::sqrt(x.val() * x.val() + 1.0);
62 });
63}
64
72template <typename VarMat, require_var_matrix_t<VarMat>* = nullptr>
73inline auto asinh(const VarMat& x) {
74 return make_callback_var(
75 x.val().unaryExpr([](const auto x) { return asinh(x); }),
76 [x](const auto& vi) mutable {
77 x.adj().array()
78 += vi.adj().array() / (x.val().array().square() + 1.0).sqrt();
79 });
80}
81
88inline std::complex<var> asinh(const std::complex<var>& z) {
90}
91
92} // namespace math
93} // namespace stan
94#endif
std::complex< V > complex_asinh(const std::complex< V > &z)
Return the hyperbolic arc sine of the complex argument.
Definition asinh.hpp:62
fvar< T > asinh(const fvar< T > &x)
Definition asinh.hpp:15
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 ...