graphix.pauli module

Pauli gates ± {1,j} × {I, X, Y, Z}.

class Pauli(symbol: IXYZ = SingletonI.I, unit: ComplexUnit = ComplexUnit.ONE)[source]

Bases: object

Pauli gate: u * {I, X, Y, Z} where u is a complex unit.

Pauli gates can be multiplied with other Pauli gates (with @), with complex units and unit constants (with *), and can be negated.

symbol: IXYZ = 1
unit: ComplexUnit = 0
I: ClassVar[Pauli] = Pauli.I
X: ClassVar[Pauli] = Pauli.X
Y: ClassVar[Pauli] = Pauli.Y
Z: ClassVar[Pauli] = Pauli.Z
static from_axis(axis: Axis) → Pauli[source]

Return the Pauli associated to the given axis.

property axis: Axis

Return the axis associated to the Pauli.

Fails if the Pauli is identity.

property matrix: npt.NDArray[np.complex128]

Return the matrix of the Pauli gate.

eigenstate(binary: int = 0) → PlanarState[source]

Return the eigenstate of the Pauli.

static iterate(symbol_only: bool = False) → Iterator[Pauli][source]

Iterate over all Pauli gates.

Parameters:
  • (bool (symbol_only)

  • optional) (Exclude the unit in the iteration. Defaults to False.)

__init__(symbol: IXYZ = SingletonI.I, unit: ComplexUnit = ComplexUnit.ONE) → None