Automatic Differentiation
 
Loading...
Searching...
No Matches
asin.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_ASIN_HPP
2#define STAN_MATH_PRIM_FUN_ASIN_HPP
3
13#include <cmath>
14#include <complex>
15
16namespace stan {
17namespace math {
18
26struct asin_fun {
27 template <typename T>
28 static inline auto fun(const T& x) {
29 using std::asin;
30 return asin(x);
31 }
32};
33
42template <typename Container,
46 Container>* = nullptr>
47inline auto asin(const Container& x) {
49}
50
59template <typename Container,
61inline auto asin(const Container& x) {
63 x, [](const auto& v) { return v.array().asin(); });
64}
65
66namespace internal {
74template <typename V>
75inline std::complex<V> complex_asin(const std::complex<V>& z) {
76 auto y_d = asin(value_of_rec(z));
77 auto y = neg_i_times(asinh(i_times(z)));
78 return copysign(y, y_d);
79}
80} // namespace internal
81
82} // namespace math
83} // namespace stan
84
85#endif
require_not_t< container_type_check_base< is_container, scalar_type_t, TypeCheck, Check... > > require_not_container_st
Require type does not satisfy is_container.
require_t< container_type_check_base< is_container, scalar_type_t, TypeCheck, Check... > > require_container_st
Require type satisfies is_container.
require_all_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< Types > >... > require_all_not_nonscalar_prim_or_rev_kernel_expression_t
Require none of the types satisfy is_nonscalar_prim_or_rev_kernel_expression.
require_not_t< is_var_matrix< std::decay_t< T > > > require_not_var_matrix_t
Require type does not satisfy is_var_matrix.
std::complex< V > complex_asin(const std::complex< V > &z)
Return the arc sine of the complex argument.
Definition asin.hpp:75
double copysign(double a, double_d b)
Definition double_d.hpp:329
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
std::complex< T > i_times(const std::complex< T > &z)
Return the specified complex number multiplied by i.
Definition i_times.hpp:20
std::complex< T > neg_i_times(const std::complex< T > &z)
Return the specified complex number multiplied by -i.
Definition i_times.hpp:36
fvar< T > asinh(const fvar< T > &x)
Definition asinh.hpp:15
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 ...
Definition fvar.hpp:9
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(const T &x)
Definition asin.hpp:28
Structure to wrap asin() so it can be vectorized.
Definition asin.hpp:26