1#ifndef STAN_MATH_PRIM_FUN_POLAR_HPP
2#define STAN_MATH_PRIM_FUN_POLAR_HPP
21template <
typename U,
typename V>
25 if (!(r >= 0) ||
is_inf(theta)) {
26 return {std::numeric_limits<double>::quiet_NaN()};
28 return {r *
cos(theta), r *
sin(theta)};
39inline std::complex<double>
polar(
double r,
double theta) {
42inline std::complex<double>
polar(
double r,
int theta) {
45inline std::complex<double>
polar(
int r,
double theta) {
48inline std::complex<double>
polar(
int r,
int theta) {
50 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 ...