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 (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – The real part.

  • y (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – 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:

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)