#[repr(C)]pub struct Complex<FT> {
pub re: FT,
pub im: FT,
}Expand description
A complex number in rectangular form.
Fields§
§re: FT§im: FTImplementations§
Source§impl Complex<f32>
impl Complex<f32>
pub const ZERO: Self
pub const ONE: Self
pub const NEG_ONE: Self
pub const I: Self
pub const NEG_I: Self
Sourcepub fn abs_sq(self) -> f32
pub fn abs_sq(self) -> f32
Computes the squared absolute value.
This is faster than abs() as it avoids a square root operation.
Sourcepub fn to_polar(self) -> ComplexPolar<f32>
pub fn to_polar(self) -> ComplexPolar<f32>
Convert to polar form.
Sourcepub fn exp(self) -> ComplexPolar<f32>
pub fn exp(self) -> ComplexPolar<f32>
Computes e^self where e is the base of the natural logarithm.
Sourcepub fn powi(self, n: i32) -> ComplexPolar<f32>
pub fn powi(self, n: i32) -> ComplexPolar<f32>
Raises self to an integer power.
Sourcepub fn powf(self, x: f32) -> ComplexPolar<f32>
pub fn powf(self, x: f32) -> ComplexPolar<f32>
Raises self to a floating point power.
Sourcepub fn distance_squared(self, other: Self) -> f32
pub fn distance_squared(self, other: Self) -> f32
Computes the squared euclidian distance between two points.
Source§impl Complex<f64>
impl Complex<f64>
pub const ZERO: Self
pub const ONE: Self
pub const NEG_ONE: Self
pub const I: Self
pub const NEG_I: Self
Sourcepub fn abs_sq(self) -> f64
pub fn abs_sq(self) -> f64
Computes the squared absolute value.
This is faster than abs() as it avoids a square root operation.
Sourcepub fn to_polar(self) -> ComplexPolar<f64>
pub fn to_polar(self) -> ComplexPolar<f64>
Convert to polar form.
Sourcepub fn exp(self) -> ComplexPolar<f64>
pub fn exp(self) -> ComplexPolar<f64>
Computes e^self where e is the base of the natural logarithm.
Sourcepub fn powi(self, n: i32) -> ComplexPolar<f64>
pub fn powi(self, n: i32) -> ComplexPolar<f64>
Raises self to an integer power.
Sourcepub fn powf(self, x: f64) -> ComplexPolar<f64>
pub fn powf(self, x: f64) -> ComplexPolar<f64>
Raises self to a floating point power.
Sourcepub fn distance_squared(self, other: Self) -> f64
pub fn distance_squared(self, other: Self) -> f64
Computes the squared euclidian distance between two points.
Trait Implementations§
Source§impl AbsDiffEq for Complex<f32>
Available on crate feature approx only.
impl AbsDiffEq for Complex<f32>
Available on crate feature
approx only.Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl AbsDiffEq for Complex<f64>
Available on crate feature approx only.
impl AbsDiffEq for Complex<f64>
Available on crate feature
approx only.Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl AddAssign<f32> for Complex<f32>
impl AddAssign<f32> for Complex<f32>
Source§fn add_assign(&mut self, re: f32)
fn add_assign(&mut self, re: f32)
Performs the
+= operation. Read moreSource§impl AddAssign<f64> for Complex<f64>
impl AddAssign<f64> for Complex<f64>
Source§fn add_assign(&mut self, re: f64)
fn add_assign(&mut self, re: f64)
Performs the
+= operation. Read moreSource§impl AddAssign for Complex<f32>
impl AddAssign for Complex<f32>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl AddAssign for Complex<f64>
impl AddAssign for Complex<f64>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl Distribution<Complex<f32>> for StandardUniform
Available on crate feature rand only.
impl Distribution<Complex<f32>> for StandardUniform
Available on crate feature
rand only.Source§impl Distribution<Complex<f64>> for StandardUniform
Available on crate feature rand only.
impl Distribution<Complex<f64>> for StandardUniform
Available on crate feature
rand only.Source§impl DivAssign<f32> for Complex<f32>
impl DivAssign<f32> for Complex<f32>
Source§fn div_assign(&mut self, re: f32)
fn div_assign(&mut self, re: f32)
Performs the
/= operation. Read moreSource§impl DivAssign<f64> for Complex<f64>
impl DivAssign<f64> for Complex<f64>
Source§fn div_assign(&mut self, re: f64)
fn div_assign(&mut self, re: f64)
Performs the
/= operation. Read moreSource§impl DivAssign for Complex<f32>
impl DivAssign for Complex<f32>
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/= operation. Read moreSource§impl DivAssign for Complex<f64>
impl DivAssign for Complex<f64>
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/= operation. Read moreSource§impl MulAssign<f32> for Complex<f32>
impl MulAssign<f32> for Complex<f32>
Source§fn mul_assign(&mut self, re: f32)
fn mul_assign(&mut self, re: f32)
Performs the
*= operation. Read moreSource§impl MulAssign<f64> for Complex<f64>
impl MulAssign<f64> for Complex<f64>
Source§fn mul_assign(&mut self, re: f64)
fn mul_assign(&mut self, re: f64)
Performs the
*= operation. Read moreSource§impl MulAssign for Complex<f32>
impl MulAssign for Complex<f32>
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*= operation. Read moreSource§impl MulAssign for Complex<f64>
impl MulAssign for Complex<f64>
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*= operation. Read moreSource§impl RelativeEq for Complex<f32>
Available on crate feature approx only.
impl RelativeEq for Complex<f32>
Available on crate feature
approx only.Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
The inverse of
RelativeEq::relative_eq.Source§impl RelativeEq for Complex<f64>
Available on crate feature approx only.
impl RelativeEq for Complex<f64>
Available on crate feature
approx only.Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
The inverse of
RelativeEq::relative_eq.Source§impl SubAssign<f32> for Complex<f32>
impl SubAssign<f32> for Complex<f32>
Source§fn sub_assign(&mut self, re: f32)
fn sub_assign(&mut self, re: f32)
Performs the
-= operation. Read moreSource§impl SubAssign<f64> for Complex<f64>
impl SubAssign<f64> for Complex<f64>
Source§fn sub_assign(&mut self, re: f64)
fn sub_assign(&mut self, re: f64)
Performs the
-= operation. Read moreSource§impl SubAssign for Complex<f32>
impl SubAssign for Complex<f32>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreSource§impl SubAssign for Complex<f64>
impl SubAssign for Complex<f64>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreSource§impl UlpsEq for Complex<f32>
Available on crate feature approx only.
impl UlpsEq for Complex<f32>
Available on crate feature
approx only.Source§impl UlpsEq for Complex<f64>
Available on crate feature approx only.
impl UlpsEq for Complex<f64>
Available on crate feature
approx only.impl<FT: Copy> Copy for Complex<FT>
impl<FT> StructuralPartialEq for Complex<FT>
Auto Trait Implementations§
impl<FT> Freeze for Complex<FT>where
FT: Freeze,
impl<FT> RefUnwindSafe for Complex<FT>where
FT: RefUnwindSafe,
impl<FT> Send for Complex<FT>where
FT: Send,
impl<FT> Sync for Complex<FT>where
FT: Sync,
impl<FT> Unpin for Complex<FT>where
FT: Unpin,
impl<FT> UnwindSafe for Complex<FT>where
FT: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more