Returns the projection of the complex number
zonto the
Riemann sphere.
For most
z,
std::proj(z) == z, but all complex infinities, even the numbers where one component is infinite and the other is NaN, become positive real infinity,
(INFINITY, 0.0)or
(INFINITY, -0.0). The sign of the imaginary (zero) component is the sign of
std::imag(z).
A,B) Additional overloads are provided for all integer and floating-point types, which are treated as complex numbers with positive zero imaginary component.
[edit] Parameters z - complex value f - floating-point value i - integer value [edit] Return value1) The projection of z onto the Riemann sphere.
A)The projection of
std::complex(f)onto the Riemann sphere.
B)The projection of
std::complex<double>(i)onto the Riemann sphere.
[edit] NotesThe proj function helps model the Riemann sphere by mapping all infinities to one (give or take the sign of the imaginary zero), and should be used just before any operation, especially comparisons, that might give spurious results for any of the other infinities.
The additional overloads are not required to be provided exactly as (A,B). They only need to be sufficient to ensure that for their argument num:
T
, then std::proj(num) has the same effect as std::proj(std::complex<T>(num)).Output:
proj(1,2) = (1,2) proj(inf,-1) = (inf,-0) proj(0,-inf) = (inf,-0)[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4