Skip to content

v0.3.1 — Internal cleanup and PEC crash fix

Choose a tag to compare

@FedorShind FedorShind released this 15 Apr 12:59
· 38 commits to main since this release

Internal cleanup release. No API changes — drop-in upgrade with pip install -U emrg.

Fixed

  • _compute_pec_samples no longer crashes on deep circuits. Forcing --technique pec on a circuit deep enough that the overhead estimate saturated to math.inf raised OverflowError. It now returns PEC_MAX_SAMPLES for inf and nan overheads, so the CLI and generate_recipe() degrade gracefully instead of aborting.

Performance

  • analyze_circuit runs 9–44% faster on circuits with 20+ qubits. Layer heterogeneity and non-Clifford counting now share a single DAG traversal instead of building the DAG twice. Measured on the benchmark suite:

    • Random 20q: −17% (1.09 ms → 0.91 ms)
    • Random 30q: −44% (3.68 ms → 2.07 ms)
    • Random 50q: −23% (6.52 ms → 5.02 ms)

    Small circuits see similar relative wins; absolute time is already sub-millisecond.

Changed

  • run_preview now catches only (ValueError, RuntimeError, ImportError, NotImplementedError) instead of every Exception. Real programmer errors — wrong observable shape, Mitiq API drift, unexpected types — now surface instead of being silently wrapped as a user-facing warning. Failures also emit a debug traceback via logging.getLogger("emrg.preview"); enable it with logging.basicConfig(level=logging.DEBUG).
  • emrg[preview] no longer pulls qiskit-aer (never imported).
  • New emrg[qasm3] extra installs qiskit_qasm3_import for OpenQASM 3 input.
  • Development status classifier: Alpha → Beta.

Internal

Quality pass on the cleanup front — no behavior change for users:

  • Removed dead code: _make_noiseless_executor (superseded by _make_executor(0.0, ...)) and a stale no-op branch in format_preview.
  • Consolidated observable string parsing (Z0, Z1, ..., ZZ) into one classifier used by both parse and label paths.
  • Relocated the make_features test helper into tests/conftest.py.
  • Pytest now runs with --strict-markers --strict-config -ra.

Verification

  • 366 → 369 tests (three new regression tests pin the PEC overflow fix).
  • Coverage held at 96%.
  • ruff check clean.
  • Benchmark suite passes end-to-end including ZNE, PEC, and CDR fidelity comparisons.

Full Changelog: v0.3.0...v0.3.1