Module pauli_string

Module pauli_string 

Source
Expand description

PauliString<W> — symplectic-encoded Pauli operator on up to 64·W qubits.

Encoding: I = (0, 0), X = (1, 0), Z = (0, 1), Y = (1, 1). Multiplication XORs the (x, z) parts and returns the i^k phase factor — for k ∈ 0..4 — that arises where X- and Z-bits coincide. The phase is not stored on the type; callers fold it into a Complex64 coefficient at the boundary (PauliSum, BuildAccumulator, or Channel::apply).

The load-bearing trait is Ord — the propagation engine is sort-based, not hashmap-based. Hash is implemented as an auxiliary for BuildAccumulator.

See design doc §3.1.

§Examples

X · Z = -i·Y: the XOR gives the Y bits and the returned Phase is the -i factor.

use paulistrings::{PauliString, Phase};

let mut p = PauliString::<1>::x(0);
let phase = p.mul_assign(&PauliString::<1>::z(0));
assert_eq!(p, PauliString::<1>::y(0));
assert_eq!(phase, Phase::MINUS_I);

Structs§

PauliString
A Pauli operator on up to 64 · W qubits.