README.md

August 22, 2026 · View on GitHub

TenCirPauli logo

TenCirPauli

Rust-native Pauli algebra and structured quantum execution for TensorCircuit-NG.

CI status Documentation PyPI version Apache 2.0 license

TenCirPauli moves Pauli-heavy quantum workflows from Python object graphs into compact native data and Rust execution. It is the TensorCircuit-NG-facing layer for Hamiltonians, measurement grouping, symmetry reduction, restricted sectors, structured operators, classical-shadow snapshots, and observable propagation.

What it does

CapabilityMain entry points
Pauli algebra and HamiltoniansPauliWord, PauliOperator, products, commutators, dense/COO/CSR targets, matrix-free MVP
Measurement planninggroup_commuting(mode="qubit_wise"), QWCGroupingResult, basis-aware bitstring reconstruction
Classical-shadow snapshotsSnapshots.sample(), Pauli/global-Clifford protocols, native estimators, RDM, Rényi-2 entropy, and fidelity
Static stabilizer-code analysisStabilizerCode, ordered syndromes, logical representatives, error classification, and decoder-correction verification; distinct from StabilizerState
Symmetry reductionfind_z2_symmetries(), taper_z2(), restrict_charge() with U1Sector or ChargeSector
Native circuit executionU1Circuit, PropagationCircuit, SPPSCircuit, value/gradient and expectation terminals
Structured quantum operatorsFermionOperator, BosonOperator, QuditWeylOperator, HybridOperator, MajoranaOperator
Fermion and chemistry workflowsJordan–Wigner, parity, Bravyi–Kitaev, optional PySCF ingestion, TensorCircuit-NG integration

Why it is fast

  • Scalable symbolic work stays in Rust over packed Pauli, occupation, charge, and structured representations.
  • Public results are lazy native-backed handles by default; Python materializes terms or arrays only when an API explicitly asks for them.
  • Matrix-free and restricted-sector plans avoid dense matrices and full Hilbert spaces when the workload has useful structure.
  • TensorCircuit-NG and JAX can remain at the backend boundary through reusable backend_mvp_plan() plans, while native CPU paths use coarse-grained Rust execution and default parallelism.

Performance snapshots

These are representative runs from the linked research studies, not universal maxima. The benchmark page collects the workload definitions and runnable examples.

WorkloadComparisonResult
60-qubit, two-particle U(1) VQETensorCircuit-NG Python/JAX path688× faster on the first compiled value-and-gradient call; 2.6× faster when steady
28-qubit Pauli-propagation VQEPauliPropagation.jl7.8× faster on the first call; 1.43× faster when steady
12-mode fermion mappingOpenFermion22× faster for Jordan–Wigner; 12.6× faster for Bravyi–Kitaev
64-qubit, 1,024-term QWC groupingQiskit38× faster grouping on the linked workload, with native reconstruction included in the study
4×4 Fermi–Hubbard restricted MVPQuSpin1.73× faster and 2.16× lower peak memory

Choose an entry point

If you need to...Start with...
Build or transform Pauli operatorsPauliOperator.from_terms() and PauliWord.from_string()
Group terms for measurementsoperator.group_commuting(); use QWC mode for measurement-ready bases
Estimate observables from randomized measurementsSnapshots.sample() followed by expectation(), estimate_many(), or energy()
Analyze a static qubit stabilizer codeStabilizerCode.from_css() / from_generators(); the code space has dimension 2**nlogical, while StabilizerState is a pure-state tableau
Apply a large Hamiltonian without a matrixoperator.native_mvp_plan() or operator.mvp()
Keep TensorCircuit-NG/JAX activeoperator.backend_mvp_plan() and tencirpauli.backend_mvp()
Reduce a symmetry sectoroperator.find_z2_symmetries() / operator.taper_z2()
Work at fixed particle number or additive chargeU1Sector, ChargeSector, and operator.restrict_charge()
Run a native circuit objectiveU1Circuit, PropagationCircuit, or SPPSCircuit
Map or compile structured operatorsFermionQubitMapping, MajoranaOperator, and the structured operator classes

mode="general" is available for algebraic commuting groups, but its result is intentionally measurement_ready=False; use QWC grouping when the output must directly describe product-basis measurements.

TensorCircuit-NG ecosystem

TenCirPauli is designed as a TensorCircuit-NG companion, not a replacement for its circuit frontend. TensorCircuit-NG circuits can be converted with U1Circuit.from_circuit() or PropagationCircuit.from_circuit(), and Pauli backend plans can be called through TensorCircuit-NG's NumPy or JAX backend. The Rust core itself has no Python or TensorCircuit-NG dependency.

Research examples

The research index links to reproducible, manual studies covering Fermi–Hubbard, Holstein, SYK Majorana, BCH convergence, Lie closure, fermion mapping, U(1) VQE, Pauli propagation, measurement grouping, and classical shadows.

Install

python -m pip install tencirpauli

Released wheels cover common CPython 3.10+ platforms. Source builds require Rust, Cargo, and maturin; chemistry interop is optional via python -m pip install 'tencirpauli[chemistry]'.

Documentation and development

Read the documentation for concepts and API details, performance notes for benchmark context, and CONTRIBUTING.md for local development. The local quality gate is python scripts/check.py --benchmark smoke.

License

Apache License 2.0.