# `ExTorch.Complex`

An ``ExTorch.Complex`` is a struct that represents a complex number with real and imaginary parts.

**Note**: This struct only provides a mechanism to exchange imaginary value between Elixir and LibTorch and therefore
does not provide any arithmetic functions.

# `t`

```elixir
@type t() :: %ExTorch.Complex{
  imaginary: number() | :nan | :inf | :ninf,
  real: number() | :nan | :inf | :ninf
}
```

An ``ExTorch.Complex`` is a struct that represents a complex number with real and imaginary parts.

# `complex`

```elixir
@spec complex(number() | :nan | :inf | :ninf, number() | :nan | :inf | :ninf) :: t()
```

Create an `ExTorch.Complex` struct with real and imaginary parts.

## Arguments
- `re` - The real part of the complex number (`number() | :nan | :inf | :ninf`)
- `im` - The imaginary part of the complex number (`number() | :nan | :inf | :ninf`)

## Returns
- `complex` - An imaginary number with real part `re` and imaginary part `im` (`ExTorch.Complex`)

# `im`

```elixir
@spec im(t()) :: number() | :nan | :inf | :ninf
```

Retrieve the imaginary part of a complex number

## Arguments
- `complex` - A complex number (`ExTorch.Complex`)

## Returns
- `im` - The imaginary part of the input complex number. (`number() | :nan | :inf | :ninf`)

# `re`

```elixir
@spec re(t()) :: number() | :nan | :inf | :ninf
```

Retrieve the real part of a complex number

## Arguments
- `complex` - A complex number (`ExTorch.Complex`)

## Returns
- `re` - The real part of the input complex number. (`number() | :nan | :inf | :ninf`)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
