[−][src]Struct quantum2::complex::Complex
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.
fn add(self, rhs: Complex) -> Complex
[src]
impl Mul<Complex> for Complex
[src]
type Output = Complex
The resulting type after applying the *
operator.
fn mul(self, rhs: Complex) -> Complex
[src]
impl Neg for Complex
[src]
impl AddAssign<Complex> for Complex
[src]
fn add_assign(&mut self, rhs: Complex)
[src]
impl MulAssign<Complex> for Complex
[src]
fn mul_assign(&mut self, rhs: 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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,