std::conj(std::complex)_C++中文网
| 定义于头文件 |
||
| (1) | ||
| template< class T > |
(C++20 前) | |
| template< class T > |
(C++20 起) | |
| (2) | ||
| std::complex<float> conj( float z ); template< class DoubleOrInteger > |
(C++11 起) (C++20 前) |
|
| constexpr std::complex<float> conj( float z ); template< class DoubleOrInteger > |
(C++20 起) | |
1) 通过反转虚部符号计算 z 的复共轭。
|
2) 为 float 、 double 、 long double 和所有整数类型添加额外重载,它们将参数当做虚部为零的复数。 |
(C++11 起) |
参数
返回值
z 的复共轭
示例
#include <iostream> #include <complex> int main() { std::complex<double> z(1,2); std::cout << "The conjugate of " << z << " is " << std::conj(z) << '\n' << "Their product is " << z*std::conj(z) << '\n'; }
输出:
The conjugate of (1,2) is (1,-2) Their product is (5,0)