std:: conj (std::complex)
|
ヘッダーで定義
<complex>
|
||
| (1) | ||
|
template
<
class
T
>
std:: complex < T > conj ( const std:: complex < T > & z ) ; |
(C++20まで) | |
|
template
<
class
T
>
constexpr std:: complex < T > conj ( const std:: complex < T > & z ) ; |
(C++20から) | |
|
追加のオーバーロード
(C++11以降)
|
||
|
ヘッダーで定義
<complex>
|
||
| (A) | ||
|
std::
complex
<
float
>
conj
(
float
f
)
;
std::
complex
<
double
>
conj
(
double
f
)
;
|
(C++20まで) | |
|
constexpr
std::
complex
<
float
>
conj
(
float
f
)
;
constexpr
std::
complex
<
double
>
conj
(
double
f
)
;
|
(C++20から)
(C++23まで) |
|
|
template
<
class
FloatingPoint
>
constexpr std:: complex < FloatingPoint > conj ( FloatingPoint f ) ; |
(C++23から) | |
| (B) | ||
|
template
<
class
Integer
>
constexpr std:: complex < double > conj ( Integer i ) ; |
(C++20まで) | |
|
template
<
class
Integer
>
constexpr std:: complex < double > conj ( Integer i ) ; |
(C++20以降) | |
|
A,B)
すべての整数型および浮動小数点型に対して追加のオーバーロードが提供されており、これらは虚数部がゼロの複素数として扱われます。
|
(C++11以降) |
目次 |
パラメータ
| z | - | 複素数値 |
| f | - | 浮動小数点値 |
| i | - | 整数値 |
戻り値
注記
追加のオーバーロードは (A,B) と厳密に同一である必要はありません。それらは引数 num に対して以下を保証するのに十分であればよいのです:
-
num
が
標準
(C++23まで)
浮動小数点型
Tを持つ場合、 std :: conj ( num ) は std :: conj ( std:: complex < T > ( num ) ) と同じ効果を持つ。 - それ以外の場合、 num が整数型を持つならば、 std :: conj ( num ) は std :: conj ( std:: complex < double > ( num ) ) と同じ効果を持つ。
例
#include <complex> #include <iostream> int main() { std::complex<double> z(1.0, 2.0); 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)
関連項目
|
複素数の絶対値を返す
(関数テンプレート) |
|
|
絶対値の2乗を返す
(関数テンプレート) |
|
|
絶対値と偏角から複素数を構築する
(関数テンプレート) |
|
|
Cドキュメント
for
conj
|
|