complex

Contents

complex#

class saiunit.lax.complex(x, y, **kwargs)#

Elementwise make complex number: \(x + jy\).

Build a complex number from real and imaginary parts.

Parameters:
  • x (Union[saiunit.Quantity, Array, ndarray, number, bool]) – The real part.

  • y (Union[saiunit.Quantity, Array, ndarray, number, bool]) – The imaginary part. Must have the same unit as x.

Returns:

result – The complex array. If inputs are Quantity, the result preserves the same unit.

Return type:

Union[saiunit.Quantity, Array]

Examples

>>> import saiunit as u
>>> import saiunit.lax as sulax
>>> import jax.numpy as jnp
>>> real = jnp.array([1.0, 2.0]) * u.volt
>>> imag = jnp.array([3.0, 4.0]) * u.volt
>>> result = sulax.complex(real, imag)
>>> result.mantissa
Array([1.+3.j, 2.+4.j], dtype=complex64)