C++ 复杂库 - 项目


描述

它是一个复数投影,返回复数 x 在黎曼球面上的投影。x 的投影为 x,但复无穷大除外,复无穷大会映射到实部为 INFINITY 且虚部为 0.0 或 -0.0(如果支持)的复数值,具体取决于 x 虚部的符号。

宣言

以下是 std::proj 的声明。

template<class T> complex<T> proj (const complex<T>& x);

C++11

	
template<class T> complex<T> proj (const complex<T>& x);

参数

x - 这是一个复数值。

返回值

它返回复数 x 在黎曼球面上的投影。

例外情况

没有任何

例子

在下面的 std::proj 示例中。

#include <iostream>     
#include <complex>      
#include <limits>       

int main () {
   std::complex<double> mycomplex (std::numeric_limits<double>::infinity(),3.0);

   std::cout << "The projection of " << mycomplex << " is " << std::proj(mycomplex)
      << '\n';

   return 0;
}

示例输出应该是这样的 -

The projection of (inf,3) is (inf,0)
复杂.htm