Struct quantum::other::qubit::NonEntangledQubit
[−]
[src]
pub struct NonEntangledQubit {
// some fields omitted
}Represents a single (pure, not entangled) qubit state of the form a|0> + b|1>.
The qubit is the linear superposition of the computational basis of |0>_ and _|1>.
We encode the complex coeffients as tuples of their real and imaginary parts, each represented as a 64-bit floating points. This gives high accuracy, while allowing word-size arithmetic on 64-bit systems.
The theoretical state should always satisfy the equations:
a = a_re + i * a_imb = b_re + i * b_im1 = |a|^2+ |b|^2
This representation of that state should approximately satisfy them, subject to floating point imprecision.
Methods
impl NonEntangledQubit[src]
fn new(a_re: f64, a_im: f64, b_re: f64, b_im: f64) -> NonEntangledQubit
Safely construct a qubit, given the real and imaginary parts of both coefficients.
This function validates that the given state is possible.
fn validate(&self) -> bool
Validate that this qubit's state is possible.
In our imperfect floating point model, this means computing |a|^2+ |b|^2 and
comparing it to 1 with some leeway.
That leeway is arbitrarily chosen as 10 units of least precision.
Trait Implementations
Derived Implementations
impl Debug for NonEntangledQubit[src]
impl Copy for NonEntangledQubit[src]
impl Clone for NonEntangledQubit[src]
fn clone(&self) -> NonEntangledQubit
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