Automatic Differentiation
 
Loading...
Searching...
No Matches
proj.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_PROJ_HPP
2#define STAN_MATH_PRIM_FUN_PROJ_HPP
3
5#include <complex>
6#include <limits>
7
8namespace stan {
9namespace math {
18template <typename V>
19inline std::complex<V> proj(const std::complex<V>& z) {
20 return std::proj(z);
21}
22
23namespace internal {
32template <typename V>
33inline std::complex<V> complex_proj(const std::complex<V>& z) {
34 if (is_inf(z.real()) || is_inf(z.imag())) {
35 return {std::numeric_limits<V>::infinity(), z.imag() < 0 ? -0.0 : 0.0};
36 }
37 return z;
38}
39} // namespace internal
40} // namespace math
41} // namespace stan
42
43#endif
std::complex< V > complex_proj(const std::complex< V > &z)
Return the projection of the complex argument onto the Riemann sphere.
Definition proj.hpp:33
std::complex< fvar< T > > proj(const std::complex< fvar< T > > &z)
Return the projection of the complex argument onto the Riemann sphere.
Definition proj.hpp:20
int is_inf(const fvar< T > &x)
Returns 1 if the input's value is infinite and 0 otherwise.
Definition is_inf.hpp:21
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9