pub struct StabilizerState {
pub n_qubits: usize,
pub generators: Vec<PauliString>,
}Expand description
A stabilizer state specified by its stabilizer group generators.
The stabilizer state |ψ⟩ is the unique state satisfying g|ψ⟩ = |ψ⟩ for every generator g in the stabilizer group.
Fields§
§n_qubits: usize§generators: Vec<PauliString>Generators of the stabilizer group (each is an n-qubit Pauli string).
Implementations§
Source§impl StabilizerState
impl StabilizerState
Sourcepub fn from_generators(n_qubits: usize, generators: Vec<PauliString>) -> Self
pub fn from_generators(n_qubits: usize, generators: Vec<PauliString>) -> Self
Create a stabilizer state from a list of generators.
Assumes the generators are already a valid independent commuting set.
Sourcepub fn computational_zero(n_qubits: usize) -> Self
pub fn computational_zero(n_qubits: usize) -> Self
The |0…0⟩ state, stabilized by Z_0, Z_1, …, Z_{n-1}.
Sourcepub fn plus_state(n_qubits: usize) -> Self
pub fn plus_state(n_qubits: usize) -> Self
The |+…+⟩ state, stabilized by X_0, X_1, …, X_{n-1}.
Sourcepub fn is_consistent(&self) -> bool
pub fn is_consistent(&self) -> bool
Check that all generators commute pairwise (consistency requirement).
Sourcepub fn measure_pauli(&self, p: &PauliString) -> Option<i8>
pub fn measure_pauli(&self, p: &PauliString) -> Option<i8>
Measure a Pauli observable P on this stabilizer state.
Returns Some(+1) if P is in the stabilizer group, Some(-1) if -P
is in the stabilizer group, or None if the outcome is probabilistic
(P anti-commutes with some generator).
Trait Implementations§
Source§impl Clone for StabilizerState
impl Clone for StabilizerState
Source§fn clone(&self) -> StabilizerState
fn clone(&self) -> StabilizerState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more