pub struct PauliString {
pub nqubits: usize,
pub x: Vec<u64>,
pub z: Vec<u64>,
/* private fields */
}Expand description
A Pauli operator on nqubits qubits, with a two-bit phase exponent of i.
Equality is structural — it compares the stored phase byte and both bitsets, not the operator up to phase.
§Examples
use ticit::{neg, pauli_string};
let xyz = pauli_string("XYZ")?;
assert_eq!(xyz.to_string(), "XYZ");
assert_eq!(neg(xyz).to_string(), "-XYZ");Fields§
§nqubits: usizeNumber of qubits in the operator.
x: Vec<u64>Packed LSB-first X bits; qubit q is bit q & 63 of word q >> 6.
z: Vec<u64>Packed LSB-first Z bits, with the same layout as x.
Implementations§
Source§impl PauliString
impl PauliString
Sourcepub fn phase_exponent(&self) -> i32
pub fn phase_exponent(&self) -> i32
Exponent of i in the stored phase, in 0..=3.
Sourcepub fn set_phase(&mut self, phase_exponent: i32)
pub fn set_phase(&mut self, phase_exponent: i32)
Sets the phase exponent modulo 4; negative inputs wrap the same way the
C++ & 3 on a signed int does.
Sourcepub fn phase_shift(&mut self, delta: i32)
pub fn phase_shift(&mut self, delta: i32)
Adds delta to the stored phase exponent modulo four.
Sourcepub fn has_nonidentity_body(&self) -> bool
pub fn has_nonidentity_body(&self) -> bool
Returns whether any qubit carries X, Y, or Z instead of identity.
Trait Implementations§
Source§impl Clone for PauliString
impl Clone for PauliString
Source§fn clone(&self) -> PauliString
fn clone(&self) -> PauliString
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PauliString
impl Debug for PauliString
Source§impl Default for PauliString
impl Default for PauliString
Source§fn default() -> PauliString
fn default() -> PauliString
Returns the “default value” for a type. Read more
Source§impl Display for PauliString
impl Display for PauliString
impl Eq for PauliString
Source§impl Mul for PauliString
impl Mul for PauliString
Source§type Output = PauliString
type Output = PauliString
The resulting type after applying the
* operator.Source§fn mul(self, rhs: PauliString) -> PauliString
fn mul(self, rhs: PauliString) -> PauliString
Performs the
* operation. Read moreSource§impl Mul<&PauliString> for &PauliString
impl Mul<&PauliString> for &PauliString
Source§fn mul(self, rhs: &PauliString) -> PauliString
fn mul(self, rhs: &PauliString) -> PauliString
Panics if the operands act on different numbers of qubits: every caller multiplies rows of one tableau, so a mismatch is a wiring bug.
Source§type Output = PauliString
type Output = PauliString
The resulting type after applying the
* operator.Source§impl PartialEq for PauliString
impl PartialEq for PauliString
impl StructuralPartialEq for PauliString
Auto Trait Implementations§
impl Freeze for PauliString
impl RefUnwindSafe for PauliString
impl Send for PauliString
impl Sync for PauliString
impl Unpin for PauliString
impl UnsafeUnpin for PauliString
impl UnwindSafe for PauliString
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