top of page

Complex64

Flag4j has two built in implementations for complex numbers. This page covers Flag4j's 64-bit complex number.
The Complex64 class inherits from the Field interface and is immutable. This class represents a complex number in cartesian form using two 32-bit floats.

Initialization

A Complex64 value can be initialized from a single real value, two values specifying the real and imaginary component, or a String.
If a String is used to initialize a Complex64, it must adhere to the following grammar after all white space has been removed:
<COMPLEX_64> -> <FLOAT> |
                <FLOAT> "i" |
                <FLOAT> <SIGN> <FLOAT> "i"
<SIGN> -> + | -
where <FLOAT> must be parsable by Java's Float.valueOf().

The real and imaginary components can be extracted as follows:

Arithmetic

Complex64 objects support all basic arithmetic and trigonometric operations including: addition, subtraction, multiplication, division, exponentiation, logarithms, (hyperbolic) trig functions, etc.
For a full list of supported operations see the Javadoc API reference.
bottom of page