#[repr(transparent)]pub struct Complex<T> { /* private fields */ }
Expand description
Complex number.
Implementations
sourceimpl<T> Complex<T>
impl<T> Complex<T>
pub fn new(w: T, x: T) -> Self
pub fn from_vector(vec: Vector2<T>) -> Self
pub fn from_array(arr: [T; 2]) -> Self
pub fn from_tuple(tup: (T, T)) -> Self
pub fn from_num(nc: NumComplex<T>) -> Self
pub fn into_vector(self) -> Vector2<T>
pub fn into_array(self) -> [T; 2]
pub fn into_tuple(self) -> (T, T)
pub fn into_num(self) -> NumComplex<T>
sourceimpl<T> Complex<T> where
T: Neg<Output = T> + Copy,
impl<T> Complex<T> where
T: Neg<Output = T> + Copy,
pub fn into_matrix(self) -> Matrix2x2<T>
sourceimpl<T: Float> Complex<T>
impl<T: Float> Complex<T>
pub fn exp(self) -> Self
pub fn ln(self) -> Self
pub fn sqrt(self) -> Self
pub fn cbrt(self) -> Self
pub fn powf(self, exp: T) -> Self
pub fn log(self, base: T) -> Self
pub fn powc(self, exp: Self) -> Self
pub fn expf(self, base: T) -> Self
pub fn sin(self) -> Self
pub fn cos(self) -> Self
pub fn tan(self) -> Self
pub fn asin(self) -> Self
pub fn acos(self) -> Self
pub fn atan(self) -> Self
pub fn sinh(self) -> Self
pub fn cosh(self) -> Self
pub fn tanh(self) -> Self
pub fn asinh(self) -> Self
pub fn acosh(self) -> Self
pub fn atanh(self) -> Self
pub fn finv(self) -> Self
pub fn fdiv(self, other: Self) -> Self
Trait Implementations
sourceimpl<T> AbsDiffEq<Complex<T>> for Complex<T> where
T: AbsDiffEq<Epsilon = T> + Copy,
impl<T> AbsDiffEq<Complex<T>> for Complex<T> where
T: AbsDiffEq<Epsilon = T> + Copy,
type Epsilon = T
type Epsilon = T
Used for specifying relative comparisons.
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn 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. Read more
sourcefn 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
.
sourceimpl<T> Add<Complex<T>> for Quaternion<T> where
T: Add<Output = T>,
impl<T> Add<Complex<T>> for Quaternion<T> where
T: Add<Output = T>,
sourceimpl Add<Quaternion<f32>> for Complex<f32>
impl Add<Quaternion<f32>> for Complex<f32>
Workaround for reverse addition.
type Output = Quaternion<f32>
type Output = Quaternion<f32>
The resulting type after applying the +
operator.
sourceimpl Add<Quaternion<f64>> for Complex<f64>
impl Add<Quaternion<f64>> for Complex<f64>
Workaround for reverse addition.
type Output = Quaternion<f64>
type Output = Quaternion<f64>
The resulting type after applying the +
operator.
sourceimpl<T> AddAssign<Complex<T>> for Complex<T> where
T: AddAssign,
impl<T> AddAssign<Complex<T>> for Complex<T> where
T: AddAssign,
sourcefn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the +=
operation. Read more
sourceimpl<T> AddAssign<Complex<T>> for Quaternion<T> where
T: AddAssign,
impl<T> AddAssign<Complex<T>> for Quaternion<T> where
T: AddAssign,
sourcefn add_assign(&mut self, other: Complex<T>)
fn add_assign(&mut self, other: Complex<T>)
Performs the +=
operation. Read more
sourceimpl<T> AddAssign<T> for Complex<T> where
T: AddAssign,
impl<T> AddAssign<T> for Complex<T> where
T: AddAssign,
sourcefn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
Performs the +=
operation. Read more
sourceimpl<T> Directional<Complex<T>> for Moebius<Complex<T>> where
Self: Transform<Complex<T>>,
Complex<T>: Normalize,
impl<T> Directional<Complex<T>> for Moebius<Complex<T>> where
Self: Transform<Complex<T>>,
Complex<T>: Normalize,
sourceimpl<T> Distribution<Complex<T>> for Normal where
Normal: Distribution<Vector<T, 2>>,
impl<T> Distribution<Complex<T>> for Normal where
Normal: Distribution<Vector<T, 2>>,
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Complex<T>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Complex<T>
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
sourceimpl<T: Float> Distribution<Complex<T>> for NonZero where
NonZero: Distribution<Vector<T, 2>>,
impl<T: Float> Distribution<Complex<T>> for NonZero where
NonZero: Distribution<Vector<T, 2>>,
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Complex<T>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Complex<T>
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
sourceimpl<T: Float> Distribution<Complex<T>> for Unit where
Unit: Distribution<Vector<T, 2>>,
impl<T: Float> Distribution<Complex<T>> for Unit where
Unit: Distribution<Vector<T, 2>>,
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Complex<T>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Complex<T>
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
sourceimpl<T> Div<Quaternion<T>> for Complex<T> where
T: Neg<Output = T> + Num + Copy,
impl<T> Div<Quaternion<T>> for Complex<T> where
T: Neg<Output = T> + Num + Copy,
type Output = Quaternion<T>
type Output = Quaternion<T>
The resulting type after applying the /
operator.
sourcefn div(self, other: Quaternion<T>) -> Self::Output
fn div(self, other: Quaternion<T>) -> Self::Output
Performs the /
operation. Read more
sourceimpl<T> DivAssign<Complex<T>> for Complex<T> where
Self: Div<Output = Self> + Copy,
impl<T> DivAssign<Complex<T>> for Complex<T> where
Self: Div<Output = Self> + Copy,
sourcefn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the /=
operation. Read more
sourceimpl<T> DivAssign<Complex<T>> for Quaternion<T> where
Self: Div<Complex<T>, Output = Self> + Copy,
impl<T> DivAssign<Complex<T>> for Quaternion<T> where
Self: Div<Complex<T>, Output = Self> + Copy,
sourcefn div_assign(&mut self, other: Complex<T>)
fn div_assign(&mut self, other: Complex<T>)
Performs the /=
operation. Read more
sourceimpl<T> DivAssign<T> for Complex<T> where
Self: Div<T, Output = Self> + Copy,
impl<T> DivAssign<T> for Complex<T> where
Self: Div<T, Output = Self> + Copy,
sourcefn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
Performs the /=
operation. Read more
sourceimpl<T> From<Complex<T>> for Complex<T>
impl<T> From<Complex<T>> for Complex<T>
sourcefn from(nc: NumComplex<T>) -> Self
fn from(nc: NumComplex<T>) -> Self
Converts to this type from the input type.
sourceimpl<T> From<Complex<T>> for NumComplex<T>
impl<T> From<Complex<T>> for NumComplex<T>
sourceimpl<T> Mul<Complex<T>> for Complex<T> where
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Copy,
impl<T> Mul<Complex<T>> for Complex<T> where
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Copy,
sourceimpl<T> Mul<Complex<T>> for Quaternion<T> where
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Copy,
impl<T> Mul<Complex<T>> for Quaternion<T> where
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Copy,
sourceimpl<T> Mul<Quaternion<T>> for Complex<T> where
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Copy,
impl<T> Mul<Quaternion<T>> for Complex<T> where
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Copy,
type Output = Quaternion<T>
type Output = Quaternion<T>
The resulting type after applying the *
operator.
sourcefn mul(self, other: Quaternion<T>) -> Self::Output
fn mul(self, other: Quaternion<T>) -> Self::Output
Performs the *
operation. Read more
sourceimpl<T> MulAssign<Complex<T>> for Complex<T> where
Self: Mul<Output = Self> + Copy,
impl<T> MulAssign<Complex<T>> for Complex<T> where
Self: Mul<Output = Self> + Copy,
sourcefn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the *=
operation. Read more
sourceimpl<T> MulAssign<Complex<T>> for Quaternion<T> where
Self: Mul<Complex<T>, Output = Self> + Copy,
impl<T> MulAssign<Complex<T>> for Quaternion<T> where
Self: Mul<Complex<T>, Output = Self> + Copy,
sourcefn mul_assign(&mut self, other: Complex<T>)
fn mul_assign(&mut self, other: Complex<T>)
Performs the *=
operation. Read more
sourceimpl<T> MulAssign<T> for Complex<T> where
Self: Mul<T, Output = Self> + Copy,
impl<T> MulAssign<T> for Complex<T> where
Self: Mul<T, Output = Self> + Copy,
sourcefn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
Performs the *=
operation. Read more
sourceimpl<T: Float> NormL2 for Complex<T>
impl<T: Float> NormL2 for Complex<T>
type Output = T
type Output = T
Type of the norm.
sourcefn norm_l2_sqr(self) -> T
fn norm_l2_sqr(self) -> T
Square norm of the element.
sourceimpl<T: Neg<Output = T> + Num + Copy> Num for Complex<T>
impl<T: Neg<Output = T> + Num + Copy> Num for Complex<T>
type FromStrRadixErr = ParseComplexError<<T as Num>::FromStrRadixErr>
sourcefn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically 2..=36
). Read more
sourceimpl<T> Sub<Complex<T>> for Quaternion<T> where
T: Sub<Output = T>,
impl<T> Sub<Complex<T>> for Quaternion<T> where
T: Sub<Output = T>,
sourceimpl Sub<Quaternion<f32>> for Complex<f32>
impl Sub<Quaternion<f32>> for Complex<f32>
Workaround for reverse subtraction.
type Output = Quaternion<f32>
type Output = Quaternion<f32>
The resulting type after applying the -
operator.
sourceimpl Sub<Quaternion<f64>> for Complex<f64>
impl Sub<Quaternion<f64>> for Complex<f64>
Workaround for reverse subtraction.
type Output = Quaternion<f64>
type Output = Quaternion<f64>
The resulting type after applying the -
operator.
sourceimpl<T> SubAssign<Complex<T>> for Complex<T> where
T: SubAssign,
impl<T> SubAssign<Complex<T>> for Complex<T> where
T: SubAssign,
sourcefn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the -=
operation. Read more
sourceimpl<T> SubAssign<Complex<T>> for Quaternion<T> where
T: SubAssign,
impl<T> SubAssign<Complex<T>> for Quaternion<T> where
T: SubAssign,
sourcefn sub_assign(&mut self, other: Complex<T>)
fn sub_assign(&mut self, other: Complex<T>)
Performs the -=
operation. Read more
sourceimpl<T> SubAssign<T> for Complex<T> where
T: SubAssign,
impl<T> SubAssign<T> for Complex<T> where
T: SubAssign,
sourcefn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
Performs the -=
operation. Read more
sourceimpl<T> Transform<Complex<T>> for Moebius<Complex<T>> where
T: Neg<Output = T> + Num + Copy,
impl<T> Transform<Complex<T>> for Moebius<Complex<T>> where
T: Neg<Output = T> + Num + Copy,
impl<T: Copy> Copy for Complex<T>
impl<T> StructuralPartialEq for Complex<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Complex<T> where
T: RefUnwindSafe,
impl<T> Send for Complex<T> where
T: Send,
impl<T> Sync for Complex<T> where
T: Sync,
impl<T> Unpin for Complex<T> where
T: Unpin,
impl<T> UnwindSafe for Complex<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more