[][src]Struct quantum2::complex::Complex

pub struct Complex { /* fields omitted */ }

Holds a complex number with 64-bit float parts.

Methods

impl Complex[src]

pub fn new(re: f64, im: f64) -> Complex[src]

Construct a new complex number as re + im * i with 64-bit float parts.

pub fn new_euler(r: f64, phi: f64) -> Complex[src]

Construct a new complex number as r * exp(i * phi) with 64-bit float parts.

pub fn nth_root_of_unity(n: u32) -> Complex[src]

Construct a new primitive nth root of unity.

pub fn zero() -> Complex[src]

Zero in the complex plane, i.e. 0 + 0i.

pub fn one() -> Complex[src]

One in the complex plane, i.e. 1 + 0i.

pub fn i() -> Complex[src]

The imaginary unit.

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

Compute the square of the norm/absolute value, i.e. |z|^2.

pub fn pow(&self, n: u32) -> Complex[src]

Compute an integer power of this number efficiently with repeated squaring.

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

The real part.

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

The imaginary part.

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

Approximately equal test.

Trait Implementations

impl Clone for Complex[src]

impl Copy for Complex[src]

impl PartialEq<Complex> for Complex[src]

impl Debug for Complex[src]

impl Add<Complex> for Complex[src]

type Output = Complex

The resulting type after applying the + operator.

impl Mul<Complex> for Complex[src]

type Output = Complex

The resulting type after applying the * operator.

impl Neg for Complex[src]

type Output = Complex

The resulting type after applying the - operator.

impl AddAssign<Complex> for Complex[src]

impl MulAssign<Complex> for Complex[src]

Auto Trait Implementations

impl Send for Complex

impl Sync for Complex

impl Unpin for Complex

impl UnwindSafe for Complex

impl RefUnwindSafe for Complex

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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