complex32/complex64
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Complex number types. complex32 indicates a complex number whose real part and imaginary part are of the half type, giving it a bit width of 32 bits. complex64 indicates a complex number whose real part and imaginary part are of the float type, giving it a bit width of 64 bits.
namespace AscendC {
template<class T>
struct Complex {
T real;
T imag;
};
} // namespace AscendC
using complex32 = AscendC::Complex<half>;
using complex64 = AscendC::Complex<float>;
Parameter |
Description |
|---|---|
T |
Data type of the real and imaginary parts. Only half and float are supported. |
Function Name |
Input Parameter |
|---|---|
real |
Real part. The type is T. Only half and float are supported. |
imag |
Imaginary part. The type is T. Only half and float are supported. |
The following is an example:
// value0 indicates a complex number whose real part is 1 and imaginary part is 2, that is, 1+2j. complex32 value0(1, 2); // value1 indicates a complex number whose real part is 3 and imaginary part is 0, that is, 3+0j. complex32 value1(3); // value2 indicates a complex number whose real part is 4 and imaginary part is 0, that is, 4+0j. complex64 value2 = 4;