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

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 into_state(self, order: Representation) -> Vec<Complex<P>>; fn apply_op(&mut self, op: &UnitaryOp) { ... }
fn rotate_basis(&mut self, indices: &[u64], angle: f64) { ... } }
Expand description

A trait which represents the state of the qubits

Required methods

Make new state with n qubits

Initialize new state with initial states.

Get number of qubits represented by this state.

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

Mutate self with measurement, return result as index and probability

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

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

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

Consume the QuantumState object and return the state as a vector of complex numbers.

Provided methods

Function to mutate self into the state with op applied.

Rotate to a new computational basis: |0'> = cos(angle)|0> + sin(angle)|1> |1'> = -sin(angle)|0> + cos(angle)|1>

Implementors