[][src]Trait qip::pipeline::QuantumState

pub trait QuantumState<P: Precision> {
    fn new(n: u64) -> Self;
fn new_from_initial_states(
        n: u64,
        states: &[RegisterInitialState<P>]
    ) -> Self;
fn n(&self) -> u64;
fn apply_op_with_name(&mut self, name: Option<&str>, op: &UnitaryOp);
fn measure(
        &mut self,
        indices: &[u64],
        measured: Option<MeasuredCondition<P>>,
        angle: f64
    ) -> (u64, P);
fn soft_measure(
        &mut self,
        indices: &[u64],
        measured: Option<u64>,
        angle: f64
    ) -> (u64, P);
fn state_magnitude(&self) -> P;
fn stochastic_measure(&mut self, indices: &[u64], angle: f64) -> Vec<P>;
fn get_state(self, natural_order: bool) -> Vec<Complex<P>>; fn apply_op(&mut self, op: &UnitaryOp) { ... } }

A trait which represents the state of the qubits

Required methods

fn new(n: u64) -> Self

Make new state with n qubits

fn new_from_initial_states(n: u64, states: &[RegisterInitialState<P>]) -> Self

Initialize new state with initial states.

fn n(&self) -> u64

Get number of qubits represented by this state.

fn apply_op_with_name(&mut self, name: Option<&str>, op: &UnitaryOp)

Apply op with a given name. Mutate self using op.

fn measure(
    &mut self,
    indices: &[u64],
    measured: Option<MeasuredCondition<P>>,
    angle: f64
) -> (u64, P)

Mutate self with measurement, return result as index and probability

fn soft_measure(
    &mut self,
    indices: &[u64],
    measured: Option<u64>,
    angle: f64
) -> (u64, P)

Perform calculations of measure without mutating result. Returns a possible measured value and associated probability.

fn state_magnitude(&self) -> P

Give the total magnitude represented by this state. Most often 1.0

fn stochastic_measure(&mut self, indices: &[u64], angle: f64) -> Vec<P>

Measure stochastically, do not alter internal state. Returns a vector of size 2^indices.len()

fn get_state(self, natural_order: bool) -> Vec<Complex<P>>

Consume the QuantumState object and return the state as a vector of complex numbers. natural_order means that qubit with index 0 is the least significant index bit, otherwise it's the largest.

Loading content...

Provided methods

fn apply_op(&mut self, op: &UnitaryOp)

Function to mutate self into the state with op applied.

Loading content...

Implementors

impl<P: Precision> QuantumState<P> for LocalQuantumState<P>[src]

fn new(n: u64) -> LocalQuantumState<P>[src]

Build a new LocalQuantumState

fn new_from_initial_states(
    n: u64,
    states: &[RegisterInitialState<P>]
) -> LocalQuantumState<P>
[src]

Build a local state using a set of initial states for subsets of the qubits. These initial states are made from the qubit handles.

Loading content...