qecx.PauliProductOperator¶
- class qecx.PauliProductOperator(_be)¶
Bases:
objectEndianness-typed wrapper for a single Pauli product over
{"I", "X", "Y", "Z"}.Stores the canonical big-endian form (qubit 0 at position 0); the matching little-endian view is available on access. Construct via
from_big_endian/from_little_endianand read via thebig_endian/little_endianproperties; instances built from different endiannesses compare and hash equal whenever they denote the same observable (from_big_endian("IZ") == from_little_endian("ZI")).Alphabet contract: every character of the input must be in
{"I", "X", "Y", "Z"}. No phase is carried, no whitespace is permitted, no signed-Pauli prefix is parsed.__post_init__raisesValueErrorlisting the offending characters on any alphabet violation.- Variables:
_be (str) – Canonical big-endian form of the Pauli product. Stored directly; access externally via
big_endian.big_endian (str) – Canonical big-endian view of the Pauli product, with the leftmost character at qubit 0.
little_endian (str) – Little-endian view of the Pauli product, with the rightmost character at qubit 0.
- classmethod from_big_endian(s)¶
Construct a
PauliProductOperatorfrom a big-endian Pauli string.Big-endian convention: the leftmost character is qubit 0;
sis interpreted as-is and stored as the canonical form. Alphabet validation runs in__post_init__.- Parameters:
s (str) – Big-endian Pauli string over the alphabet
{"I", "X", "Y", "Z"}.- Returns:
Wrapper holding
sas the canonical form.- Return type:
- Raises:
ValueError – If any character of
sis outside the alphabet.
- classmethod from_little_endian(s)¶
Construct a
PauliProductOperatorfrom a little-endian Pauli string.Little-endian convention: the rightmost character of
sis qubit 0. The input is reversed before storage so that the canonical big-endian form has qubit 0 at position 0. Alphabet validation runs in__post_init__.- Parameters:
s (str) – Little-endian Pauli string over the alphabet
{"I", "X", "Y", "Z"}.- Returns:
Wrapper holding the canonical big-endian form equivalent to
s.- Return type:
- Raises:
ValueError – If any character of
sis outside the alphabet.