Defined in header <complex> | ||||
---|---|---|---|---|
| (1) | |||
| (2) | (since C++11) | ||
| (3) | (since C++11) | ||
| (4) | (since C++11) |
Computes the complex conjugate of z
by reversing the sign of the imaginary part.
(since C++11)Additional overloads are provided for float
, double
, long double
, and all integer types, which are treated as complex numbers with zero imaginary component.
Parameters
z | - | complex value |
Return value
The complex conjugate of z
.
Example
1 2 3 4 5 6 7 8 9 | #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' ; } |
Output:
1 2 | The conjugate of (1,2) is (1,-2) Their product is (5,0) |
See also
returns the magnitude of a complex number (function template) | |
returns the squared magnitude (function template) | |
constructs a complex number from magnitude and phase angle (function template) | |
C documentation for conj |
Please login to continue.