ExTorch.Complex (extorch v0.3.0)

Copy Markdown

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.

Summary

Types

t()

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

Functions

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

Retrieve the imaginary part of a complex number

Retrieve the real part of a complex number

Types

t()

@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.

Functions

complex(re, im)

@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(complex)

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

Retrieve the imaginary part of a complex number

Arguments

Returns

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

re(complex)

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

Retrieve the real part of a complex number

Arguments

Returns

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