Download Latest Version blueqat 2.1.3 -- circuit drawer supports all gates source code.zip (173.6 kB)
Email in envelope

Get an email when there's a new version of qaqarot

Home / 2.0.5
Name Modified Size InfoDownloads / Week
Parent folder
blueqat 2.0.5 -- PyTorch rewrite source code.tar.gz 2026-07-12 89.6 kB
blueqat 2.0.5 -- PyTorch rewrite source code.zip 2026-07-12 125.7 kB
README.md 2026-07-12 5.1 kB
Totals: 3 Items   220.4 kB 0

blueqat 2.0.5 — PyTorch rewrite

This release replaces blueqat's simulation core with a PyTorch backend. Circuits now run on two selectable modes — a dense statevector simulator and a memory-scalable tensornet (tensor-network contraction) simulator, which is the default — and both are differentiable end to end, so circuits built with torch.Tensor parameters keep their gradients through Circuit.run(). On top of the rewrite, this release also fixes a long list of bugs uncovered while repairing the test suite, adds several previously-missing features, and closes out the project's entire open-issue backlog.

⚠️ Breaking changes

  • blueqat.pauli and blueqat.vqe are gone; their functionality now lives in blueqat.utils (X/Y/Z/I, Expr, Term, AnsatzBase, QaoaAnsatz, Vqe, qubo_bit, ...).
  • ParametrizedCircuit is removed — pass torch.Tensor parameters directly to gates instead.
  • The IBMQ backend, the sympy symbolic backend, and the legacy numpy backend are removed. to_unitary()/dagger-based symbolic verification (which needed the sympy backend) is not yet available in the new backend.
  • Qubit ordering is now consistently qubit 0 = least-significant bit (matching Qiskit's Statevector convention) across both execution modes.

✨ New features

  • Two execution modes: run(mode="statevector") / run(mode="tensornet") (tensornet is the default). Large circuits (50+ qubits) work in tensornet mode via shots= or returns="amplitude" instead of materializing the full state vector.
  • reset gate, implemented as a real per-shot "quantum trajectory" simulation with genuine probabilistic collapse — correct even for entangled qubits.
  • initial=: inject a custom starting statevector into run().
  • Partial measurement (.m[indices]): only explicitly measured qubits are reported; the rest default to 0, matching historical behavior.
  • Measurement keys: .m(key="a")[...] plus returns="samples" returns a per-shot list of {key: [bits]} dicts, with duplicated="replace"/"append".
  • returns="statevector_and_shots" and Circuit.oneshot(): get the post-measurement collapsed state alongside its measurement outcome.
  • Circuit.to_qasm() / blueqat.circuit_funcs.from_qasm(): full OpenQASM 2.0 (qelib1.inc) round-trip. from_qasm evaluates angle expressions with a restricted AST walker rather than eval, since it parses untrusted text.
  • Circuit.ancilla(): a context manager for temporary qubit allocation, with auto-allocation or an explicit pos/stop range, and reset-on-exit.
  • Vqe.run(initial_params=...) to warm-start optimization, and Vqe.sampler_call_count to track how many times a custom sampler ran.
  • "draw_tn" backend: visualizes the tensornet backend's contraction graph with networkx (tensors as nodes, shared axes as edges).

🐛 Bug fixes

  • Restored calc_u_params, sqrt_2x2_matrix, gen_gray_controls, term_from_chars, commutator, and is_commutable, which had been accidentally dropped from blueqat.utils during the rewrite — this had completely broken blueqat.macros and the 1-qubit gate decomposer for every user, not just in tests.
  • Fixed a sign bug in the Y-Pauli matrix construction, a missing zero-coefficient filter in Expr.simplify(), a missing __ne__ on the Pauli/Term/Expr classes (which silently fell back to tuple identity comparison), and an Expr pickling bug (a custom __iter__ broke the namedtuple's __getnewargs__).
  • Fixed the tensornet and statevector modes disagreeing with each other on qubit ordering, and a control/target convention bug in the generic two-qubit gate path affecting cu, crx, cry, and cphase.
  • Fixed a destructive sys.modules-clearing hack in test fixtures that corrupted class identity across test modules; replaced with a proper backend/fixture setup.
  • Fixed a 0-qubit circuit crash and several other small robustness issues uncovered while getting the full legacy test suite passing again.

📋 Issues closed

#22, #28, #29, #30, #42, #43, #100, #116, #124, #133, #134, #151, #164, #169 — the project's entire open-issue backlog. Most were already resolved by the rewrite or by the fixes above; the rest (#42 OpenQASM parser, #116 ancilla macro, #151 tensornet graph drawing, #28 sampler call counting, #43 VQE initial parameters) got new implementations in this release.

📚 Docs & examples

  • README rewritten to match the current API; every code snippet in it was run to confirm it works as shown.
  • examples/maxcut_qaoa.py and examples/numpartition_qaoa.py were fully broken (importing removed modules) and have been fixed; added examples/bell_state.py (circuit basics) and examples/vqe_ground_state.py (general VQE, not tied to QAOA).

✅ Testing

The full test suite (1357 tests) passes with zero failures and zero skips, verified against a fresh clone in a clean virtual environment.

Source: README.md, updated 2026-07-12