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
11#include <cmath>
12#include <complex>
13
14namespace stan {
15namespace math {
16
53inline var asin(const var& x) {
54 return make_callback_var(std::asin(x.val()), [x](const auto& vi) mutable {
55 x.adj() += vi.adj() / std::sqrt(1.0 - (x.val() * x.val()));
56 });
57}
58
67template <typename VarMat, require_var_matrix_t<VarMat>* = nullptr>
68inline auto asin(const VarMat& x) {
69 return make_callback_var(
70 x.val().array().asin().matrix(), [x](const auto& vi) mutable {
71 x.adj().array()
72 += vi.adj().array() / (1.0 - (x.val().array().square())).sqrt();
73 });
74}
75
82inline std::complex<var> asin(const std::complex<var>& z) {
84}
85
86} // namespace math
87} // namespace stan
88#endif
std::complex< V > complex_asin(const std::complex< V > &z)
Return the arc sine of the complex argument.
Definition asin.hpp:75
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:15
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...