Automatic Differentiation
 
Loading...
Searching...
No Matches
asin.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_ASIN_HPP
2#define STAN_MATH_REV_FUN_ASIN_HPP
3
10#include <cmath>
11#include <complex>
12
13namespace stan {
14namespace math {
15
52inline var asin(const var& x) {
53 return make_callback_var(std::asin(x.val()), [x](const auto& vi) mutable {
54 x.adj() += vi.adj() / std::sqrt(1.0 - (x.val() * x.val()));
55 });
56}
57
66template <typename VarMat, require_var_matrix_t<VarMat>* = nullptr>
67inline auto asin(const VarMat& x) {
68 return make_callback_var(
69 x.val().array().asin().matrix(), [x](const auto& vi) mutable {
70 x.adj().array()
71 += vi.adj().array() / (1.0 - (x.val().array().square())).sqrt();
72 });
73}
74
81inline std::complex<var> asin(const std::complex<var>& z) {
83}
84
85} // namespace math
86} // namespace stan
87#endif
std::complex< V > complex_asin(const std::complex< V > &z)
Return the arc sine of the complex argument.
Definition asin.hpp:94
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...
fvar< T > asin(const fvar< T > &x)
Definition asin.hpp:16
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...