[−][src]Struct q1tsim::vectorstate::VectorState
Quantum state.
Struct Vectorstate represents the quantum experiment. It consists of a series of quantum states, combined with the number of times this state occurs in the experiment. Each quantum state is a (normalized) superposition of basis states, ∑iai|i⟩, where each basis function |i⟩ is a Kronecker product of quantum bits, and is represented by the coefficient vector a.
Methods
impl VectorState
[src]
pub fn new(nr_bits: usize, nr_shots: usize) -> Self
[src]
Create a new quantum state of nr_bits
qubits, all initialized to |0⟩,
which will be measured nr_shots
times.
pub fn from_qubit_coefs(bit_coefs: &[Complex64], nr_shots: usize) -> Self
[src]
Create a new quantum state from qubit coefficients.
Create a new quantum state as a direct product of qubits, where the
coefficients of the |0⟩ and |1⟩ states in the qubits are given in
bit_coefs
. This array must be of size 2*n
, where n
is the number
of qubits in the system. The state will be evaluated in nr_shots
separate runs.
pub fn nr_bits(&self) -> usize
[src]
Return the number of qubits in this state
Trait Implementations
impl QuState for VectorState
[src]
fn apply_gate<G: ?Sized>(&mut self, gate: &G, bits: &[usize]) -> Result<()> where
G: Gate,
[src]
G: Gate,
fn apply_unary_gate_all<G: ?Sized>(&mut self, gate: &G) -> Result<()> where
G: Gate,
[src]
G: Gate,
fn apply_conditional_gate<G: ?Sized>(
&mut self,
control: &[bool],
gate: &G,
bits: &[usize]
) -> Result<()> where
G: Gate,
[src]
&mut self,
control: &[bool],
gate: &G,
bits: &[usize]
) -> Result<()> where
G: Gate,
Apply a conditional n-ary quantum gate gate
, controlled by classical
bit control
, on the qubits from bits
in this state.
fn measure<R: Rng>(&mut self, qbit: usize, rng: &mut R) -> Result<Array1<u64>>
[src]
fn measure_into<R: Rng>(
&mut self,
qbit: usize,
cbit: usize,
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
[src]
&mut self,
qbit: usize,
cbit: usize,
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
fn measure_all<R: Rng>(&mut self, rng: &mut R) -> Result<Array1<u64>>
[src]
fn measure_all_into<R: Rng>(
&mut self,
cbits: &[usize],
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
[src]
&mut self,
cbits: &[usize],
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
fn peek_into<R: Rng>(
&self,
qbit: usize,
cbit: usize,
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
[src]
&self,
qbit: usize,
cbit: usize,
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
fn peek_all_into<R: Rng>(
&mut self,
cbits: &[usize],
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
[src]
&mut self,
cbits: &[usize],
res: &mut Array1<u64>,
rng: &mut R
) -> Result<()>
fn reset<R: Rng>(&mut self, bit: usize, rng: &mut R) -> Result<()>
[src]
fn reset_all(&mut self)
[src]
impl Debug for VectorState
[src]
Auto Trait Implementations
impl Send for VectorState
impl Sync for VectorState
impl Unpin for VectorState
impl RefUnwindSafe for VectorState
impl UnwindSafe for VectorState
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,