PauliEngineΒΆ
Fast arithmetic for quantum operators. A header-only C++20 library with a
nanobind Python frontend for Pauli strings, sums of Pauli strings (qubit
Hamiltonians) and symmetry-adapted operator bases (Pauli cycles and Pauli orbits).
Coefficients can be numeric (std::complex<double>) or symbolic (polynomials in
named parameters). There are no C++ dependencies.
Products, commutators and targeted commutators in the binary symplectic representation, also directly in the cycle and orbit bases.
Low-weight operators on many qubits are stored sparse automatically, so their cost does not grow with the number of qubits.
Arithmetic and Hilbert-Schmidt inner products between all representations.
Pauli decomposition of arbitrary \(2^n \times 2^n\) matrices.
See arXiv:2601.02233 for the algorithmic background and arXiv:2604.16701 for the cycle and orbit bases.
import pauliengine as pe
H = pe.PauliStringSum([pe.PauliString(1.0, {0: "Z", 1: "X"}),
pe.PauliString("a", {1: "X"})])
print(H.commutator(H.dagger()))
User guide
Reference