pub struct ProductBasis<const W: usize> { /* private fields */ }Expand description
A product of single-qubit stabilizer states, one per qubit: on qubit q an axis A_q ∈ {X, Y, Z} with a sign s_q ∈ {+1, -1}, i.e. |ψ⟩ = ⊗_q |A_q, s_q⟩.
Stored as bit masks in the symplectic key layout; build one with ProductBasis::uniform or ProductBasis::from_axes.
A term P has ⟨ψ|P|ψ⟩ = Π_q ⟨P_q⟩, with ⟨P_q⟩ = 1 for I, s_q for A_q, and 0 for any other Pauli.
Implementations§
Source§impl<const W: usize> ProductBasis<W>
impl<const W: usize> ProductBasis<W>
Sourcepub fn uniform(axis: PauliAxis) -> Self
pub fn uniform(axis: PauliAxis) -> Self
The +1 eigenstate of axis on every qubit: |+…+⟩, |+i…+i⟩ or |0…0⟩.
Sourcepub fn from_axes<I>(axes: I) -> Self
pub fn from_axes<I>(axes: I) -> Self
A basis from per-qubit (axis, minus) pairs: item i describes qubit i, and minus = true selects that axis’s -1 eigenstate.
Qubits past the end of the iterator match only an identity factor, so supply one pair per qubit the sum uses.
§Panics
Panics if more than 64 * W pairs are supplied.
Trait Implementations§
Source§impl<const W: usize> Clone for ProductBasis<W>
impl<const W: usize> Clone for ProductBasis<W>
Source§fn clone(&self) -> ProductBasis<W>
fn clone(&self) -> ProductBasis<W>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const W: usize> Debug for ProductBasis<W>
impl<const W: usize> Debug for ProductBasis<W>
Source§impl<const W: usize> PartialEq for ProductBasis<W>
impl<const W: usize> PartialEq for ProductBasis<W>
impl<const W: usize> Eq for ProductBasis<W>
impl<const W: usize> StructuralPartialEq for ProductBasis<W>
Auto Trait Implementations§
impl<const W: usize> Freeze for ProductBasis<W>
impl<const W: usize> RefUnwindSafe for ProductBasis<W>
impl<const W: usize> Send for ProductBasis<W>
impl<const W: usize> Sync for ProductBasis<W>
impl<const W: usize> Unpin for ProductBasis<W>
impl<const W: usize> UnwindSafe for ProductBasis<W>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
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>
Converts
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>
Converts
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