Struct Complex

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

Complex number represented in rectangular coordinates

Fields§

§real: T§imag: T

Implementations§

Source§

impl Complex<f32>

Source

pub fn new(real: f32, imag: f32) -> Complex<f32>

Source

pub fn real(&self) -> f32

Source

pub fn imag(&self) -> f32

Source

pub fn module(&self) -> f32

Source

pub fn arg(&self) -> Angle<f32>

Source

pub fn conjugate(&self) -> Self

Source§

impl Complex<f64>

Source

pub fn new(real: f64, imag: f64) -> Complex<f64>

Source

pub fn real(&self) -> f64

Source

pub fn imag(&self) -> f64

Source

pub fn module(&self) -> f64

Source

pub fn arg(&self) -> Angle<f64>

Source

pub fn conjugate(&self) -> Self

Source§

impl Complex<f32>

Source

pub fn ln(&self) -> Self

Source

pub fn log(&self, base: f32) -> Self

Source

pub fn log2(&self) -> Self

Source

pub fn log10(&self) -> Self

Source

pub fn powf(&self, power: f32) -> Self

Source

pub fn exp(&self) -> Self

Source

pub fn sqrt(&self) -> Vec<Self>

Source

pub fn root(&self, r: usize) -> Vec<Self>

Source

pub fn powc(&self, power: Complex<f32>) -> Self

Source

pub fn expf(&self, base: f32) -> Self

Source§

impl Complex<f64>

Source

pub fn ln(&self) -> Self

Source

pub fn log(&self, base: f64) -> Self

Source

pub fn log2(&self) -> Self

Source

pub fn log10(&self) -> Self

Source

pub fn powf(&self, power: f32) -> Self

Source

pub fn exp(&self) -> Self

Source

pub fn sqrt(&self) -> Vec<Self>

Source

pub fn root(&self, r: usize) -> Vec<Self>

Source

pub fn powc(&self, power: Complex<f64>) -> Self

Source

pub fn expf(&self, base: f64) -> Self

Source§

impl Complex<f32>

Source

pub fn cosh(&self) -> Self

Source

pub fn sinh(&self) -> Self

Source

pub fn tanh(&self) -> Self

Source

pub fn cos(&self) -> Self

Source

pub fn sin(&self) -> Self

Source

pub fn tan(&self) -> Self

Source§

impl Complex<f64>

Source

pub fn cosh(&self) -> Self

Source

pub fn sinh(&self) -> Self

Source

pub fn tanh(&self) -> Self

Source

pub fn cos(&self) -> Self

Source

pub fn sin(&self) -> Self

Source

pub fn tan(&self) -> Self

Trait Implementations§

Source§

impl<A> Add<A> for Complex<f32>
where A: Into<Complex<f32>>,

Source§

type Output = Complex<f32>

The resulting type after applying the + operator.
Source§

fn add(self, other: A) -> Complex<f32>

Performs the + operation. Read more
Source§

impl<A> Add<A> for Complex<f64>
where A: Into<Complex<f64>>,

Source§

type Output = Complex<f64>

The resulting type after applying the + operator.
Source§

fn add(self, other: A) -> Complex<f64>

Performs the + operation. Read more
Source§

impl<T: Clone> Clone for Complex<T>

Source§

fn clone(&self) -> Complex<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Complex<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Complex<f32>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Complex<f64>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<A> Div<A> for Complex<f32>
where A: Into<Complex<f32>>,

Source§

type Output = Complex<f32>

The resulting type after applying the / operator.
Source§

fn div(self, other: A) -> Complex<f32>

Performs the / operation. Read more
Source§

impl<A> Div<A> for Complex<f64>
where A: Into<Complex<f64>>,

Source§

type Output = Complex<f64>

The resulting type after applying the / operator.
Source§

fn div(self, other: A) -> Complex<f64>

Performs the / operation. Read more
Source§

impl<'a> From<&'a Complex<f32>> for EComplex<f32>

Source§

fn from(other: &'a Complex<f32>) -> EComplex<f32>

Converts to this type from the input type.
Source§

impl<'a> From<&'a Complex<f32>> for EComplex<f64>

Source§

fn from(other: &'a Complex<f32>) -> EComplex<f64>

Converts to this type from the input type.
Source§

impl<'a> From<&'a Complex<f64>> for EComplex<f64>

Source§

fn from(other: &'a Complex<f64>) -> EComplex<f64>

Converts to this type from the input type.
Source§

impl<'a> From<&'a EComplex<f32>> for Complex<f32>

Source§

fn from(other: &'a EComplex<f32>) -> Complex<f32>

Converts to this type from the input type.
Source§

impl<'a> From<&'a EComplex<f32>> for Complex<f64>

Source§

fn from(other: &'a EComplex<f32>) -> Complex<f64>

Converts to this type from the input type.
Source§

impl<'a> From<&'a EComplex<f64>> for Complex<f64>

Source§

fn from(other: &'a EComplex<f64>) -> Complex<f64>

Converts to this type from the input type.
Source§

impl From<(f32, f32)> for Complex<f32>

Source§

fn from(other: (f32, f32)) -> Self

Converts to this type from the input type.
Source§

impl From<(f32, f32)> for Complex<f64>

Source§

fn from(other: (f32, f32)) -> Self

Converts to this type from the input type.
Source§

impl From<(f64, f64)> for Complex<f64>

Source§

fn from(other: (f64, f64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, i16)> for Complex<f32>

Source§

fn from(other: (i16, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, i16)> for Complex<f64>

Source§

fn from(other: (i16, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, i32)> for Complex<f64>

Source§

fn from(other: (i32, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, i8)> for Complex<f32>

Source§

fn from(other: (i8, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, i8)> for Complex<f64>

Source§

fn from(other: (i8, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, u16)> for Complex<f32>

Source§

fn from(other: (u16, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, u16)> for Complex<f64>

Source§

fn from(other: (u16, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, u32)> for Complex<f64>

Source§

fn from(other: (u32, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u8)> for Complex<f32>

Source§

fn from(other: (u8, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u8)> for Complex<f64>

Source§

fn from(other: (u8, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<Complex<f32>> for EComplex<f32>

Source§

fn from(other: Complex<f32>) -> EComplex<f32>

Converts to this type from the input type.
Source§

impl From<Complex<f32>> for EComplex<f64>

Source§

fn from(other: Complex<f32>) -> EComplex<f64>

Converts to this type from the input type.
Source§

impl From<Complex<f64>> for EComplex<f64>

Source§

fn from(other: Complex<f64>) -> EComplex<f64>

Converts to this type from the input type.
Source§

impl From<EComplex<f32>> for Complex<f32>

Source§

fn from(other: EComplex<f32>) -> Complex<f32>

Converts to this type from the input type.
Source§

impl From<EComplex<f32>> for Complex<f64>

Source§

fn from(other: EComplex<f32>) -> Complex<f64>

Converts to this type from the input type.
Source§

impl From<EComplex<f64>> for Complex<f64>

Source§

fn from(other: EComplex<f64>) -> Complex<f64>

Converts to this type from the input type.
Source§

impl From<f32> for Complex<f32>

Source§

fn from(other: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Complex<f64>

Source§

fn from(other: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Complex<f64>

Source§

fn from(other: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Complex<f32>

Source§

fn from(other: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Complex<f64>

Source§

fn from(other: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Complex<f64>

Source§

fn from(other: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Complex<f32>

Source§

fn from(other: i8) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Complex<f64>

Source§

fn from(other: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Complex<f32>

Source§

fn from(other: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Complex<f64>

Source§

fn from(other: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Complex<f64>

Source§

fn from(other: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Complex<f32>

Source§

fn from(other: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Complex<f64>

Source§

fn from(other: u8) -> Self

Converts to this type from the input type.
Source§

impl<A> Mul<A> for Complex<f32>
where A: Into<Complex<f32>>,

Source§

type Output = Complex<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: A) -> Complex<f32>

Performs the * operation. Read more
Source§

impl<A> Mul<A> for Complex<f64>
where A: Into<Complex<f64>>,

Source§

type Output = Complex<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: A) -> Complex<f64>

Performs the * operation. Read more
Source§

impl Neg for Complex<f32>

Source§

type Output = Complex<f32>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Complex<f32>

Performs the unary - operation. Read more
Source§

impl Neg for Complex<f64>

Source§

type Output = Complex<f64>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Complex<f64>

Performs the unary - operation. Read more
Source§

impl<T: PartialEq> PartialEq for Complex<T>

Source§

fn eq(&self, other: &Complex<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A> Sub<A> for Complex<f32>
where A: Into<Complex<f32>>,

Source§

type Output = Complex<f32>

The resulting type after applying the - operator.
Source§

fn sub(self, other: A) -> Complex<f32>

Performs the - operation. Read more
Source§

impl<A> Sub<A> for Complex<f64>
where A: Into<Complex<f64>>,

Source§

type Output = Complex<f64>

The resulting type after applying the - operator.
Source§

fn sub(self, other: A) -> Complex<f64>

Performs the - operation. Read more
Source§

impl<T: Copy> Copy for Complex<T>

Source§

impl<T: Eq> Eq for Complex<T>

Source§

impl<T> StructuralPartialEq for Complex<T>

Auto Trait Implementations§

§

impl<T> Freeze for Complex<T>
where T: Freeze,

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.