#[repr(C)]pub struct Complex<F> {
pub re: F,
pub im: F,
}Expand description
A complex number with real and imaginary parts of type F.
It orders lexicographically (by the real part, then the imaginary part),
as lax.max, lax.min, and lax.sort compare complex numbers.
Fields§
§re: FThe real part.
im: FThe imaginary part.
Implementations§
Source§impl Complex<f32>
impl Complex<f32>
Sourcepub fn div_xla(self, o: Self) -> Self
pub fn div_xla(self, o: Self) -> Self
x / y by Smith’s algorithm, with XLA’s handling of zero
and infinite operands when the quotient would be NaN.
Sourcepub fn abs(self) -> f32
pub fn abs(self) -> f32
|x|, computed as JAX lowers it (lax.hypot of the real and
imaginary parts, scaled by a power of two against overflow and
underflow).
Sourcepub fn exp(self) -> Self
pub fn exp(self) -> Self
e^x = e^a (cos b + i sin b) (the imaginary part of a real
argument is kept, as in XLA).
Sourcepub fn pow(self, y: Self) -> Self
pub fn pow(self, y: Self) -> Self
x^y: e^(c log|x| - d arg x) (cos q + i sin q) with q = c arg x + d log|x| for y = c + di, with the special cases of
XLA’s CPU implementation: x^0 is 1, a positive real x to a
real y is real, 1^y is 1, and 0^y is 0 for real y > 0.
Sourcepub fn max(self, o: Self) -> Self
pub fn max(self, o: Self) -> Self
The maximum, comparing lexicographically as JAX lowers max
of complex numbers (y unless x is greater).
Source§impl Complex<f64>
impl Complex<f64>
Sourcepub fn div_xla(self, o: Self) -> Self
pub fn div_xla(self, o: Self) -> Self
x / y by Smith’s algorithm, with XLA’s handling of zero
and infinite operands when the quotient would be NaN.
Sourcepub fn abs(self) -> f64
pub fn abs(self) -> f64
|x|, computed as JAX lowers it (lax.hypot of the real and
imaginary parts, scaled by a power of two against overflow and
underflow).
Sourcepub fn exp(self) -> Self
pub fn exp(self) -> Self
e^x = e^a (cos b + i sin b) (the imaginary part of a real
argument is kept, as in XLA).
Sourcepub fn pow(self, y: Self) -> Self
pub fn pow(self, y: Self) -> Self
x^y: e^(c log|x| - d arg x) (cos q + i sin q) with q = c arg x + d log|x| for y = c + di, with the special cases of
XLA’s CPU implementation: x^0 is 1, a positive real x to a
real y is real, 1^y is 1, and 0^y is 0 for real y > 0.
Sourcepub fn max(self, o: Self) -> Self
pub fn max(self, o: Self) -> Self
The maximum, comparing lexicographically as JAX lowers max
of complex numbers (y unless x is greater).
Trait Implementations§
impl<F: Copy> Copy for Complex<F>
Source§impl LinalgScalar for Complex<f32>
impl LinalgScalar for Complex<f32>
Source§const IS_COMPLEX: bool = true
const IS_COMPLEX: bool = true
Source§type LinalgReal = f32
type LinalgReal = f32
Self for real types; the
element type’s Real, whose re, im, and from_parts the
algorithms use).Source§fn abs1(self) -> f32
fn abs1(self) -> f32
|re| + |im|, by which BLAS’s izamax compares complex values (the
absolute value for real types).Source§fn from_real(r: Self::LinalgReal) -> Self
fn from_real(r: Self::LinalgReal) -> Self
Source§impl LinalgScalar for Complex<f64>
impl LinalgScalar for Complex<f64>
Source§const IS_COMPLEX: bool = true
const IS_COMPLEX: bool = true
Source§type LinalgReal = f64
type LinalgReal = f64
Self for real types; the
element type’s Real, whose re, im, and from_parts the
algorithms use).Source§fn abs1(self) -> f64
fn abs1(self) -> f64
|re| + |im|, by which BLAS’s izamax compares complex values (the
absolute value for real types).