pub struct PauliSet {
pub n: usize,
/* private fields */
}
Expand description
A set of Pauli operators (module global phase) Conjugation by Clifford gates are vectorized
Fields§
§n: usize
Implementations§
Source§impl PauliSet
impl PauliSet
Sourcepub fn new_empty(n: usize, m: usize) -> Self
pub fn new_empty(n: usize, m: usize) -> Self
Allocate a set of m n-qubit Pauli operators set to the identity
pub fn from_slice(data: &[String]) -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn insert(&mut self, axis: &str, phase: bool) -> usize
pub fn insert(&mut self, axis: &str, phase: bool) -> usize
Inserts a new Pauli operator in the set and returns its index
Sourcepub fn insert_vec_bool(&mut self, axis: &[bool], phase: bool) -> usize
pub fn insert_vec_bool(&mut self, axis: &[bool], phase: bool) -> usize
Inserts a new Pauli operator described as a vector of bool in the set and returns its index
pub fn insert_pauli(&mut self, pauli: &Pauli) -> usize
pub fn set_phase(&mut self, col: usize, phase: bool)
pub fn set_entry( &mut self, operator_index: usize, qbit: usize, x_part: bool, z_part: bool, )
pub fn set_raw_entry(&mut self, row: usize, col: usize, value: bool)
Sourcepub fn set_to_identity(&mut self, operator_index: usize)
pub fn set_to_identity(&mut self, operator_index: usize)
Set some operator to identity (because popping in the middle is expensive :O)
Sourcepub fn get(&self, operator_index: usize) -> (bool, String)
pub fn get(&self, operator_index: usize) -> (bool, String)
Get the operator at index operator_index
as a pair (phase, string)
Sourcepub fn get_as_vec_bool(&self, operator_index: usize) -> (bool, Vec<bool>)
pub fn get_as_vec_bool(&self, operator_index: usize) -> (bool, Vec<bool>)
Get the operator at index operator_index
as a pair (bool, Vec<bool>)
Sourcepub fn get_as_pauli(&self, operator_index: usize) -> Pauli
pub fn get_as_pauli(&self, operator_index: usize) -> Pauli
Get the operator at index operator_index
as a Pauli
object
pub fn get_phase(&self, col: usize) -> bool
pub fn get_i_factors(&self) -> Vec<u8> ⓘ
pub fn get_i_factors_single_col(&self, col: usize) -> u8
Sourcepub fn get_inverse_z(&self, qbit: usize) -> (bool, String)
pub fn get_inverse_z(&self, qbit: usize) -> (bool, String)
Get the inverse Z output of the tableau (assuming the PauliSet is a Tableau, i.e. has exactly 2n operators storing X1…Xn Z1…Zn images)
Sourcepub fn get_inverse_x(&self, qbit: usize) -> (bool, String)
pub fn get_inverse_x(&self, qbit: usize) -> (bool, String)
Get the inverse X output of the tableau (assuming the PauliSet is a Tableau, i.e. has exactly 2n operators storing X1…Xn Z1…Zn images)
Sourcepub fn and_row_acc(&self, row: usize, vec: &[bool]) -> bool
pub fn and_row_acc(&self, row: usize, vec: &[bool]) -> bool
Returns the sum mod 2 of the logical AND of a row with an external vector of booleans
pub fn get_support(&self, index: usize) -> Vec<usize>
Sourcepub fn support_size(&self, index: usize) -> usize
pub fn support_size(&self, index: usize) -> usize
Returns the support size of the operator (i.e. the number of non-I Pauli term in the operator)
pub fn swap_qbits(&mut self, i: usize, j: usize)
pub fn count_id(&self, qbit: usize) -> usize
pub fn count_leading_i(&self, qbit: usize, order: &[usize]) -> usize
Sourcepub fn pauli_pair_index(&self, i: usize, j: usize, col: usize) -> usize
pub fn pauli_pair_index(&self, i: usize, j: usize, col: usize) -> usize
Returns (the index of) the Pauli pair over the qubits i
and j
for the Pauli operator in column col
.
Sourcepub fn count_leading_i_conjugation(
&self,
i: usize,
j: usize,
q: usize,
c: usize,
order: &[usize],
) -> usize
pub fn count_leading_i_conjugation( &self, i: usize, j: usize, q: usize, c: usize, order: &[usize], ) -> usize
Computes the score of conjugating the Pauli pair over the qubits i
and j
by chunk c
. This is equivalent to the scoring function described in the
paper but uses the precomputed table lookup instead of performing conjugation.
Sourcepub fn support_size_sort(&mut self)
pub fn support_size_sort(&mut self)
Sorts the set by support size
Trait Implementations§
Source§impl PauliLike for PauliSet
impl PauliLike for PauliSet
fn cz(&mut self, i: usize, j: usize)
Source§fn conjugate_with_gate(&mut self, gate: &CliffordGate)
fn conjugate_with_gate(&mut self, gate: &CliffordGate)
Source§fn conjugate_with_circuit(&mut self, circuit: &CliffordCircuit)
fn conjugate_with_circuit(&mut self, circuit: &CliffordCircuit)
impl StructuralPartialEq for PauliSet
Auto Trait Implementations§
impl Freeze for PauliSet
impl RefUnwindSafe for PauliSet
impl Send for PauliSet
impl Sync for PauliSet
impl Unpin for PauliSet
impl UnwindSafe for PauliSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more