1#ifndef STAN_MATH_PRIM_FUN_POLAR_HPP
2#define STAN_MATH_PRIM_FUN_POLAR_HPP
22template <
typename U,
typename V>
24 if (!(r >= 0) ||
is_inf(theta)) {
25 return {std::numeric_limits<double>::quiet_NaN()};
27 return {r *
cos(theta), r *
sin(theta)};
38template <
typename U,
typename V, require_all_arithmetic_t<U, V>* =
nullptr>
39inline std::complex<double>
polar(U r, V theta) {
41 static_cast<double>(theta));
std::complex< real_return_t< Ts... > > complex_return_t
Convenience type to calculate the complex return type, which wraps std::complex around the return typ...
complex_return_t< U, V > complex_polar(const U &r, const V &theta)
Returns complex number with specified magnitude and phase angle.
fvar< T > sin(const fvar< T > &x)
std::complex< fvar< T > > polar(const fvar< T > &r, const fvar< T > &theta)
Returns complex number with specified magnitude and phase angle.
fvar< T > cos(const fvar< T > &x)
int is_inf(const fvar< T > &x)
Returns 1 if the input's value is infinite and 0 otherwise.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...