# symforce.geo.complex module¶

class Complex(real, imag)[source]

Bases: `Group`

A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers, and i is a solution of the equation x**2 = -1. Because no real number satisfies this equation, i is called an imaginary number. For the complex number a + bi, a is called the real part, and b is called the imaginary part. Despite the historical nomenclature “imaginary”, complex numbers are regarded in the mathematical sciences as just as “real” as the real numbers, and are fundamental in many aspects of the scientific description of the natural world.

A complex number is also a convenient way to store a two-dimensional rotation.

References

https://en.wikipedia.org/wiki/Complex_number

Parameters:
• real (`float`) –

• imag (`float`) –

__init__(real, imag)[source]

Construct from a real and imaginary scalar.

Parameters:
• real (Scalar) –

• imag (Scalar) –

classmethod storage_dim()[source]

Dimension of underlying storage

Return type:

`int`

to_storage()[source]

Flat list representation of the underlying storage, length of STORAGE_DIM. This is used purely for plumbing, it is NOT like a tangent space.

Return type:

`List`[`float`]

classmethod from_storage(vec)[source]

Construct from a flat list representation. Opposite of .to_storage().

Parameters:

vec (`Sequence`[`float`]) –

Return type:

`Complex`

classmethod symbolic(name, **kwargs)[source]

Construct a symbolic element with the given name prefix. Kwargs are forwarded to sf.Symbol (for example, sympy assumptions).

Parameters:
• name (`str`) –

• kwargs (`Any`) –

Return type:

`Complex`

classmethod identity()[source]

Identity element such that compose(a, identity) = a.

Return type:

`Complex`

compose(other)[source]

Apply the group operation with other.

Parameters:

other (`Complex`) –

Return type:

`Complex`

inverse()[source]

Group inverse, such that compose(a, inverse(a)) = identity.

Return type:

`Complex`

classmethod zero()[source]

Zero value.

Return type:

Complex

conj()[source]

Complex conjugate (real, -imag).

Return type:

Complex

squared_norm()[source]

Squared norm of the two-vector.

Returns:

real**2 + imag**2

Return type:

Scalar

__mul__(right)[source]

Complex multiplication (composition).

Parameters:

right (Complex) –

Return type:

Complex

Parameters:

right (Complex) –

Return type:

Complex

__neg__()[source]

Element-wise negation.

Return type:

Complex

__div__(scalar)[source]

Scalar element-wise division.

Parameters:

scalar (Scalar) –

Return type:

Complex

__truediv__(scalar)

Scalar element-wise division.

Parameters:

scalar (Scalar) –

Return type:

Complex

classmethod random_uniform(low, high)[source]

Generate a random complex number with real and imaginary parts between the given bounds

Parameters:
• low (`float`) –

• high (`float`) –

Return type:

`Complex`

classmethod unit_random()[source]

Generate a unit-norm random complex number

Return type:

`Complex`

classmethod unit_random_from_uniform_sample(u1, pi=pi)[source]

Generate a unit-norm random Complex number from a variable sampled uniformly on [0, 1]

Parameters:
• u1 (`float`) –

• pi (`float`) –

Return type:

`Complex`