Complex number representation.

Static variables

staticread onlyangle:Float

Complex argument, in radians.

@:value(new Complex(0, 1))staticfinalread onlyim:Complex = new Complex(0, 1)

The imaginary unit.

staticread onlymagnitude:Float

Complex module.

@:value(new Complex(0, 0))staticfinalread onlyzero:Complex = new Complex(0, 0)

The complex zero.

Static methods

@:op(A + B)staticinlineadd(this:{real:Float, imag:Float}, rhs:Complex):Complex

staticinlineconj(this:{real:Float, imag:Float}):Complex

Returns the complex conjugate, does not modify this object.

staticinlinecopy(this:{real:Float, imag:Float}):Complex

staticinlineexp(w:Float):Complex

Computes the complex exponential e^(iw).

@:fromstaticinlinefromReal(r:Float):Complex

Makes a Complex number with the given Float as its real part and a zero imag part.

@:op(A * B)staticinlinemult(this:{real:Float, imag:Float}, rhs:Complex):Complex

staticinlinescale(this:{real:Float, imag:Float}, k:Float):Complex

Multiplication by a real factor, does not modify this object.

@:op(A - B)staticinlinesub(this:{real:Float, imag:Float}, rhs:Complex):Complex