#[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<FT: Number> Complex<FT>
impl<FT: Number> Complex<FT>
pub const ZERO: Self
pub const ONE: Self
pub const I: Self
pub fn square(self) -> Self
Sourcepub fn abs_sq(self) -> FT
pub fn abs_sq(self) -> FT
Computes the squared absolute value.
This is faster than abs() as it avoids a square root operation.
Sourcepub fn expm1(self) -> Self
pub fn expm1(self) -> Self
Computes e^self - 1.
More numerically stable than self.exp().to_rectangular() - 1 when self ≈ 0.
Sourcepub fn ln_1p(self) -> Self
pub fn ln_1p(self) -> Self
Computes the principal natural logarithm of 1 + self.
More numerically stable than (self + 1).ln() when self ≈ 0.
Sourcepub fn ln_branch(self, k: i32) -> Self
pub fn ln_branch(self, k: i32) -> Self
Computes the k-th branch of the natural logarithm.
The principal value is k = 0. Each increment of k adds 2πi.
Sourcepub fn ln_1p_branch(self, k: i32) -> Self
pub fn ln_1p_branch(self, k: i32) -> Self
Computes the k-th branch of the natural logarithm of 1 + self.
The principal value is k = 0. Each increment of k adds 2πi.
Sourcepub fn log2_branch(self, k: i32) -> Self
pub fn log2_branch(self, k: i32) -> Self
Computes the k-th branch of the base-2 logarithm.
Sourcepub fn log10_branch(self, k: i32) -> Self
pub fn log10_branch(self, k: i32) -> Self
Computes the k-th branch of the base-10 logarithm.
Sourcepub fn sqrt_branch(self, k: i32) -> Polar<FT>
pub fn sqrt_branch(self, k: i32) -> Polar<FT>
Computes the k-th square root.
The principal value is k = 0. Only k = 0 and k = 1 give distinct values.
Sourcepub fn nth_root(self, n: i32, k: i32) -> Polar<FT>
pub fn nth_root(self, n: i32, k: i32) -> Polar<FT>
Computes the k-th value of the n-th root.
The n distinct values correspond to k = 0..n-1.
Sourcepub fn pow_rational(self, p: i32, q: i32, k: i32) -> Polar<FT>
pub fn pow_rational(self, p: i32, q: i32, k: i32) -> Polar<FT>
Raises self to the rational power p/q, selecting the k-th branch.
There are q distinct values corresponding to k = 0..q-1, provided p/q is in lowest
terms. If p/q is not reduced, first reduce it to find the true number of distinct values.
Sourcepub fn distance_squared(self, other: Self) -> FT
pub fn distance_squared(self, other: Self) -> FT
Computes the squared euclidian distance between two points.
Source§impl<FT: AsPrimitive<f32>> Complex<FT>
impl<FT: AsPrimitive<f32>> Complex<FT>
Trait Implementations§
Source§impl<FT: AbsDiffEq + Copy> AbsDiffEq for Complex<FT>
Available on crate feature approx only.
impl<FT: AbsDiffEq + Copy> AbsDiffEq for Complex<FT>
approx only.Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq.Source§impl<FT: Number> AddAssign for Complex<FT>
impl<FT: Number> AddAssign for Complex<FT>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+= operation. Read moreSource§impl<FT: Number> AddAssign<FT> for Complex<FT>
impl<FT: Number> AddAssign<FT> for Complex<FT>
Source§fn add_assign(&mut self, re: FT)
fn add_assign(&mut self, re: FT)
+= operation. Read moreimpl<FT: Copy> Copy for Complex<FT>
Source§impl Distribution<Complex<f32>> for StandardUniform
Available on crate feature rand only.
impl Distribution<Complex<f32>> for StandardUniform
rand only.Source§impl Distribution<Complex<f64>> for StandardUniform
Available on crate feature rand only.
impl Distribution<Complex<f64>> for StandardUniform
rand only.Source§impl<FT: Number> DivAssign for Complex<FT>
impl<FT: Number> DivAssign for Complex<FT>
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
/= operation. Read moreSource§impl<FT: Number> DivAssign<FT> for Complex<FT>
impl<FT: Number> DivAssign<FT> for Complex<FT>
Source§fn div_assign(&mut self, re: FT)
fn div_assign(&mut self, re: FT)
/= operation. Read moreSource§impl<FT: Number> MulAssign for Complex<FT>
impl<FT: Number> MulAssign for Complex<FT>
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
*= operation. Read moreSource§impl<FT: Number> MulAssign<FT> for Complex<FT>
impl<FT: Number> MulAssign<FT> for Complex<FT>
Source§fn mul_assign(&mut self, re: FT)
fn mul_assign(&mut self, re: FT)
*= operation. Read moreSource§impl<FT: RelativeEq + Copy> RelativeEq for Complex<FT>
Available on crate feature approx only.
impl<FT: RelativeEq + Copy> RelativeEq for Complex<FT>
approx only.Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
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
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
RelativeEq::relative_eq.impl<FT: PartialEq> StructuralPartialEq for Complex<FT>
Source§impl<FT: Number> SubAssign for Complex<FT>
impl<FT: Number> SubAssign for Complex<FT>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-= operation. Read moreSource§impl<FT: Number> SubAssign<FT> for Complex<FT>
impl<FT: Number> SubAssign<FT> for Complex<FT>
Source§fn sub_assign(&mut self, re: FT)
fn sub_assign(&mut self, re: FT)
-= operation. Read moreSource§impl<FT: UlpsEq + Copy> UlpsEq for Complex<FT>
Available on crate feature approx only.
impl<FT: UlpsEq + Copy> UlpsEq for Complex<FT>
approx only.