Automatic Differentiation
 
Loading...
Searching...
No Matches
arg.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_ARG_HPP
2#define STAN_MATH_PRIM_FUN_ARG_HPP
3
5#include <cmath>
6#include <complex>
7
8namespace stan {
9namespace math {
17template <typename V, require_arithmetic_t<V>* = nullptr>
18inline V arg(const std::complex<V>& z) {
19 return std::arg(z);
20}
21
22namespace internal {
30template <typename V>
31inline V complex_arg(const std::complex<V>& z) {
32 return atan2(z.imag(), z.real());
33}
34} // namespace internal
35} // namespace math
36} // namespace stan
37
38#endif
V complex_arg(const std::complex< V > &z)
Return the phase angle of the complex argument.
Definition arg.hpp:31
fvar< T > atan2(const fvar< T > &x1, const fvar< T > &x2)
Definition atan2.hpp:14
fvar< T > arg(const std::complex< fvar< T > > &z)
Return the phase angle of the complex argument.
Definition arg.hpp:19
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...