[][src]Struct ohsl::complex::Complex

pub struct Complex<T> {
    pub real: T,
    pub imag: T,
}

Fields

real: T

Real part of the complex number

imag: T

Imaginary part of the complex number

Implementations

impl<T> Complex<T>[src]

pub const fn new(real: T, imag: T) -> Self[src]

Create a new complex number ( z = x + iy )

impl<T: Clone + Signed> Complex<T>[src]

pub fn conj(&self) -> Self[src]

Return the complex conjugate ( z.conj() = x - iy )

impl<T: Clone + Number> Complex<T>[src]

pub fn abs_sqr(&self) -> T[src]

Return the absolute value squared ( |z|^2 = z * z.conj() )

impl Complex<f64>[src]

pub fn abs(&self) -> f64[src]

Return the absolute value ( |z| = sqrt( z * z.conj() ) )

impl Complex<f64>[src]

pub fn arg(&self) -> f64[src]

Return the phase angle in radians

Trait Implementations

impl<T: Clone + Number> Add<Complex<T>> for Complex<T>[src]

type Output = Self

The resulting type after applying the + operator.

pub fn add(self, plus: Self) -> Self::Output[src]

Add two complex numbers together ( binary + ) ( a + ib ) + ( c + id ) = ( a + c ) + i( b + d )

impl<T: Number> Add<T> for Complex<T>[src]

type Output = Complex<T>

The resulting type after applying the + operator.

pub fn add(self, plus: T) -> Self::Output[src]

Add a complex number to a real number ( a + ib ) + c = ( a + c ) + ib

impl<T: Number> AddAssign<Complex<T>> for Complex<T>[src]

pub fn add_assign(&mut self, rhs: Self)[src]

Add a complex number to a mutable complex variable and assign the result to that variable ( += )

impl<T: Number> AddAssign<T> for Complex<T>[src]

pub fn add_assign(&mut self, rhs: T)[src]

Add a real number to a mutable complex variable and assign the result to that variable ( += )

impl<T: Clone> Clone for Complex<T>[src]

pub fn clone(&self) -> Self[src]

Clone the complex number

impl Copy for Complex<f64>[src]

impl<T> Debug for Complex<T> where
    T: Debug
[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Format the output ( z = x + iy = ( x, y ) )

impl<T> Display for Complex<T> where
    T: Display
[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Format the output ( z = x + iy = ( x, y ) )

impl<T: Clone + Number> Div<Complex<T>> for Complex<T>[src]

type Output = Self

The resulting type after applying the / operator.

pub fn div(self, divisor: Self) -> Self::Output[src]

Divide one complex number by another ( binary / ) ( a + ib ) / ( c + id ) = [( ac + bd ) + i( bc - ad )] / ( c^2 + d^2 )

impl<T: Clone + Number> Div<T> for Complex<T>[src]

type Output = Complex<T>

The resulting type after applying the / operator.

pub fn div(self, scalar: T) -> Self::Output[src]

Divide a complex number by a real scalar ( a + ib ) / r = (a/r) + i(b/r)

impl<T: Clone + Number> DivAssign<Complex<T>> for Complex<T>[src]

pub fn div_assign(&mut self, rhs: Self)[src]

Divide a mutable complex variable by a complex number and assign the result to that variable ( *= )

impl<T: Clone + Number> DivAssign<T> for Complex<T>[src]

pub fn div_assign(&mut self, rhs: T)[src]

Divide a mutable complex variable by a real number and assign the result to that variable ( /= )

impl<T: Clone + Number> Mul<Complex<T>> for Complex<T>[src]

type Output = Self

The resulting type after applying the * operator.

pub fn mul(self, times: Self) -> Self::Output[src]

Multiply two complex numbers together ( binary * ) ( a + ib ) * ( c + id ) = ( ac - bd ) + i( ad + bc )

impl<T: Clone + Number> Mul<T> for Complex<T>[src]

type Output = Complex<T>

The resulting type after applying the * operator.

pub fn mul(self, scalar: T) -> Self::Output[src]

Multiply a complex number by a real scalar ( a + ib ) * r = (ar) + i(br)

impl<T: Clone + Number> MulAssign<Complex<T>> for Complex<T>[src]

pub fn mul_assign(&mut self, rhs: Self)[src]

Multipy a mutable complex variable by a complex number and assign the result to that variable ( *= )

impl<T: Clone + Number> MulAssign<T> for Complex<T>[src]

pub fn mul_assign(&mut self, rhs: T)[src]

Multiply a mutable complex variable by a real number and assign the result to that variable ( *= )

impl<T: Clone + Signed> Neg for Complex<T>[src]

type Output = Self

The resulting type after applying the - operator.

pub fn neg(self) -> Self::Output[src]

Return the unary negation ( unary - )

  • ( a + ib ) = -a - ib

impl<T: Number + Clone> Number for Complex<T>[src]

impl<T: Clone + Number> One for Complex<T>[src]

pub fn one() -> Self[src]

Return the multiplicative identity z = 1 + 0i

impl<T: Clone + Number> PartialEq<Complex<T>> for Complex<T>[src]

pub fn eq(&self, other: &Complex<T>) -> bool[src]

Implement trait for equality

impl<T: Clone + Number + PartialOrd> PartialOrd<Complex<T>> for Complex<T>[src]

pub fn partial_cmp(&self, other: &Complex<T>) -> Option<Ordering>[src]

Implement trait for ordering

impl Signed for Complex<f64>[src]

impl<T: Clone + Number> Sub<Complex<T>> for Complex<T>[src]

type Output = Self

The resulting type after applying the - operator.

pub fn sub(self, minus: Self) -> Self::Output[src]

Subtract one complex number from another ( binary - ) ( a + ib ) - ( c + id ) = ( a - c ) + i( b - d )

impl<T: Number> Sub<T> for Complex<T>[src]

type Output = Complex<T>

The resulting type after applying the - operator.

pub fn sub(self, minus: T) -> Self::Output[src]

Subtract a real number from a complex number ( a + ib ) - c = ( a - c ) + ib

impl<T: Number> SubAssign<Complex<T>> for Complex<T>[src]

pub fn sub_assign(&mut self, rhs: Self)[src]

Subtract a complex number from a mutable complex variable and assign the result to that variable ( -= )

impl<T: Number> SubAssign<T> for Complex<T>[src]

pub fn sub_assign(&mut self, rhs: T)[src]

Subtract a real number from a mutable complex variable and assign the result to that variable ( += )

impl<T: Clone + Number> Zero for Complex<T>[src]

pub fn zero() -> Self[src]

Return the additive identity z = 0 + 0i

Auto Trait Implementations

impl<T> RefUnwindSafe for Complex<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Complex<T> where
    T: Send
[src]

impl<T> Sync for Complex<T> where
    T: Sync
[src]

impl<T> Unpin for Complex<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Complex<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, Rhs> AssignOperations<Rhs> for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs>, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Rhs, Output> Operations<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,