Complex
Module
Implements the Complex type.
Aliases:
ComplexF32 = ComplexSIMD[f32, 1]
ComplexF64 = ComplexSIMD[f64, 1]
ComplexSIMD
Represents a complex SIMD value.
The class provides basic methods for manipulating complex values.
Parameters:
- type (
DType
): DType of the value. - size (
Int
): SIMD width of the value.
Fields:
im
The imaginary part of the complex SIMD value.
re
The real part of the complex SIMD value.
Functions:
__init__
__init__(re: SIMD[type, size], im: SIMD[type, size]) -> Self
__neg__
__neg__(self: Self) -> Self
Negates the complex value.
Returns:
The negative of the complex value.
__add__
__add__(self: Self, rhs: Self) -> Self
Add two complex values.
Args:
- rhs (
Self
): Complex value to add.
Returns:
A sum of this and RHS complex values.
__mul__
__mul__(self: Self, rhs: Self) -> Self
Multiple two complex values.
Args:
- rhs (
Self
): Complex value to multiply with.
Returns:
A product of this and RHS complex values.
fma
fma(self: Self, b: Self, c: Self) -> Self
Compute FMA operation.
Compute fused multiple-add with two other complex values: result = self * b + c
Args:
- b (
Self
): Multiplier complex value. - c (
Self
): Complex value to add.
Returns:
Computed Self * B + C
complex value.
norm
norm(self: Self) -> SIMD[type, size]
Returns the squared magnitude of the complex value.
Returns:
Value of re*re + im*im
.
sq_add
sq_add(self: Self, c: Self) -> Self
Compute Square-Add operation.
Compute Self * Self + C
.
Args:
- c (
Self
): Complex value to add.
Returns:
Computed Self * Self + C
complex value.