1 #ifndef STAN_MATH_PRIM_FUN_ARG_HPP 2 #define STAN_MATH_PRIM_FUN_ARG_HPP 3 4 #include <cmath> 5 #include <complex> 6 7 namespace stan { 8 namespace math { 9 namespace internal { 10 /** 11 * Return the phase angle of the complex argument. 12 * 13 * @tparam V value type of argument 14 * @param[in] z argument 15 * @return phase angle of the argument 16 */ 17 template <typename V> complex_arg(const std::complex<V> & z)18inline V complex_arg(const std::complex<V>& z) { 19 using std::atan2; 20 return atan2(z.imag(), z.real()); 21 } 22 } // namespace internal 23 } // namespace math 24 } // namespace stan 25 26 #endif 27