| Name | Modified | Size | Downloads / 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.pauliandblueqat.vqeare gone; their functionality now lives inblueqat.utils(X/Y/Z/I,Expr,Term,AnsatzBase,QaoaAnsatz,Vqe,qubo_bit, ...).ParametrizedCircuitis removed — passtorch.Tensorparameters 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
Statevectorconvention) 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 viashots=orreturns="amplitude"instead of materializing the full state vector. resetgate, implemented as a real per-shot "quantum trajectory" simulation with genuine probabilistic collapse — correct even for entangled qubits.initial=: inject a custom starting statevector intorun().- Partial measurement (
.m[indices]): only explicitly measured qubits are reported; the rest default to0, matching historical behavior. - Measurement keys:
.m(key="a")[...]plusreturns="samples"returns a per-shot list of{key: [bits]}dicts, withduplicated="replace"/"append". returns="statevector_and_shots"andCircuit.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_qasmevaluates angle expressions with a restricted AST walker rather thaneval, since it parses untrusted text.Circuit.ancilla(): a context manager for temporary qubit allocation, with auto-allocation or an explicitpos/stoprange, and reset-on-exit.Vqe.run(initial_params=...)to warm-start optimization, andVqe.sampler_call_countto 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, andis_commutable, which had been accidentally dropped fromblueqat.utilsduring the rewrite — this had completely brokenblueqat.macrosand 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 anExprpickling 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, andcphase. - 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.pyandexamples/numpartition_qaoa.pywere fully broken (importing removed modules) and have been fixed; addedexamples/bell_state.py(circuit basics) andexamples/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.