Automatic Differentiation
 
Loading...
Searching...
No Matches
acos.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_ACOS_HPP
2#define STAN_MATH_PRIM_FUN_ACOS_HPP
3
15#include <cmath>
16#include <complex>
17
18namespace stan {
19namespace math {
20
28template <typename T, require_arithmetic_t<T>* = nullptr>
29inline auto acos(const T x) {
30 return std::acos(x);
31}
32
40template <typename T, require_complex_bt<std::is_arithmetic, T>* = nullptr>
41inline auto acos(const T x) {
42 return std::acos(x);
43}
44
52struct acos_fun {
53 template <typename T>
54 static inline auto fun(const T& x) {
55 return acos(x);
56 }
57};
58
67template <typename Container, require_ad_container_t<Container>* = nullptr>
68inline auto acos(const Container& x) {
70}
71
80template <typename Container,
82inline auto acos(const Container& x) {
83 return apply_vector_unary<Container>::apply(
84 x, [](const auto& v) { return v.array().acos(); });
85}
86
87namespace internal {
95template <typename V>
96inline std::complex<V> complex_acos(const std::complex<V>& x) {
97 return 0.5 * pi() - asin(x);
98}
99} // namespace internal
100
101} // namespace math
102} // namespace stan
103
104#endif
require_t< container_type_check_base< is_container, base_type_t, TypeCheck, Check... > > require_container_bt
Require type satisfies is_container.
std::complex< V > complex_acos(const std::complex< V > &x)
Return the arc cosine of the complex argument.
Definition acos.hpp:96
fvar< T > acos(const fvar< T > &x)
Definition acos.hpp:16
static constexpr double pi()
Return the value of pi.
Definition constants.hpp:36
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 ...
static auto fun(const T &x)
Definition acos.hpp:54
Structure to wrap acos() so it can be vectorized.
Definition acos.hpp:52
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...