Skip to content

Refactor to Qiskit 1.x, add alternative ansatze#1

Open
barkol wants to merge 5 commits into
mainfrom
refactor-qiskit1x-ansatze
Open

Refactor to Qiskit 1.x, add alternative ansatze#1
barkol wants to merge 5 commits into
mainfrom
refactor-qiskit1x-ansatze

Conversation

@barkol

@barkol barkol commented Apr 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Migrate from deprecated Qiskit 0.x API to Qiskit 1.x (qiskit_aer, qiskit_ibm_runtime, Statevector)
  • Extract shared circuits and cost functions into sqgen.py module (removes code duplication between script and notebook)
  • Add 3 alternative variational ansatze (hardware_efficient, strongly_entangling, circular) alongside original mcmt
  • Fix bugs (mutable default args, globals), add .gitignore, requirements.txt, README.md
  • Add test suite and benchmark scripts with results (1500-eval budget, n=1..5, 5 seeds)

Benchmark highlights (mean fidelity at 1500 evals)

Ansatz QGAN n=5 SQGEN n=5
mcmt (original) 0.708 0.588
hardware_efficient (L=3) 0.969 0.235
circular (L=3) 0.957 0.160
strongly_entangling (L=3) 0.388 0.118

Test plan

  • python test_sqgen.py — all 8 tests pass (param counts, circuit build, cost functions, QGAN loop, SQGEN loop)
  • Full benchmark completed (200 runs across 4 ansatze × 5 qubit counts × 5 seeds × 2 methods)
  • Verify notebook runs end-to-end with qiskit-ibm-runtime fake backend

🤖 Generated with Claude Code

barkol and others added 5 commits April 1, 2026 11:14
- Migrate all code from deprecated Qiskit 0.x API (execute, Aer, IBMQ)
  to Qiskit 1.x (qiskit_aer, qiskit_ibm_runtime, Statevector)
- Extract shared circuits and cost functions into sqgen.py module
- Add 3 alternative variational ansatze (hardware_efficient,
  strongly_entangling, circular) alongside original MCMT
- Fix mutable default arguments, remove globals, clean up imports
- Replace readme.txt with README.md, add .gitignore, requirements.txt
- Add test suite (test_sqgen.py) and benchmarking scripts
- Include benchmark_results.csv: 1500-eval budget, n=1..5, 5 seeds

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- sqgen_fast.py: JIT-compiled statevector simulator (2652x faster than
  Qiskit Statevector path) with pre-allocated work arrays and split
  real/imaginary representation
- Direct fidelity cost J = 1-F eliminates discriminator circuit overhead
- L-BFGS-B with maxiter=5 replaces BFGS maxiter=1
- Achieves F=1.000 for n=1..5 with hardware_efficient and circular
  ansatze at budget=1500 evals (vs F=0.235/0.160 previously at n=5)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The direct fidelity cost J = 1 - F is the exact synergic regime
of the full SQGEN objective when θ_{z_D} = 0 (Remark after Def. 3.2
in sqgen_proof_revised.tex), not an approximation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant