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
fn new_from_initial_states(n: u64, states: &[RegisterInitialState<P>]) -> Self
fn new_from_initial_states(n: u64, states: &[RegisterInitialState<P>]) -> Self
Initialize new state with initial states.
fn apply_op_with_name(&mut self, name: Option<&str>, op: &UnitaryOp)
fn apply_op_with_name(&mut self, name: Option<&str>, op: &UnitaryOp)
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.
fn state_magnitude(&self) -> P
fn state_magnitude(&self) -> P
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()
fn into_state(self, order: Representation) -> Vec<Complex<P>>
fn into_state(self, order: Representation) -> Vec<Complex<P>>
Consume the QuantumState object and return the state as a vector of complex numbers.