Struct quantum::complex::Complex
[−]
[src]
pub struct Complex {
// some fields omitted
}Holds a complex number with 64-bit float parts.
Methods
impl Complex[src]
fn new(re: f64, im: f64) -> Complex
Construct a new complex number as re + im * i with 64-bit float parts.
fn new_euler(r: f64, phi: f64) -> Complex
Construct a new complex number as r * exp(i * phi) with 64-bit float parts.
fn nth_root_of_unity(n: u32) -> Complex
Construct a new primitive nth root of unity.
fn zero() -> Complex
Zero in the complex plane, i.e. 0 + 0i.
fn one() -> Complex
One in the complex plane, i.e. 1 + 0i.
fn i() -> Complex
The imaginary unit.
fn norm_sqr(&self) -> f64
Compute the square of the norm/absolute value, i.e. |z|2.
fn pow(&self, n: u32) -> Complex
Compute an integer power of this number efficiently with repeated squaring.
fn re(&self) -> f64
The real part.
fn im(&self) -> f64
The imaginary part.
fn approx_eq(&self, other: &Complex) -> bool
Approximately equal test.
Trait Implementations
impl Add<Complex> for Complex[src]
type Output = Complex
The resulting type after applying the + operator
fn add(self, rhs: Complex) -> Complex
The method for the + operator
impl Mul<Complex> for Complex[src]
type Output = Complex
The resulting type after applying the * operator
fn mul(self, rhs: Complex) -> Complex
The method for the * operator
impl AddAssign for Complex[src]
fn add_assign(&mut self, rhs: Complex)
The method for the += operator
impl MulAssign for Complex[src]
fn mul_assign(&mut self, rhs: Complex)
The method for the *= operator
impl Neg for Complex[src]
type Output = Complex
The resulting type after applying the - operator
fn neg(self) -> Complex
The method for the unary - operator
impl Debug for Complex[src]
Derived Implementations
impl PartialEq for Complex[src]
fn eq(&self, __arg_0: &Complex) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Complex) -> bool
This method tests for !=.
impl Copy for Complex[src]
impl Clone for Complex[src]
fn clone(&self) -> Complex
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more