complex32/complex64

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

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.

The definition is as follows:
namespace AscendC {
template<class T>
struct Complex {
    T real;
    T imag;
};
} // namespace AscendC
using complex32 = AscendC::Complex<half>;
using complex64 = AscendC::Complex<float>;
Table 1 Complex template parameters

Parameter

Description

T

Data type of the real and imaginary parts. Only half and float are supported.

Table 2 Complex structure parameters

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;