complex

Provides basic functions for complex number arithmetics. A complex number is represented as a vec2, where x is the real component and y is the imaginary components.

Addition and subtraction of complex numbers, as well as multiplication and division with a real number can be performed with mathematical operators.

Get the absolute value of complex number x

float complexAbs(vec2 x);

Get the complex argument x

float complexArg(vec2 x);

Multiply complex numbers a and b

vec2 complexMult(vec2 a, vec2 b);

Divide complex number a by b

vec2 complexDiv(vec2 a, vec2 b);

Exponentiate complex number x

vec2 complexExp(vec2 x);

Compute the natural logarithm of complex number x

vec2 complexLog(vec2 x);

Compute the y's power of complex number x

vec2 complexPow(vec2 x, float y);
vec2 complexPow(vec2 x, vec2 y);