Implement QFT Section IV.1 simulation - #1692
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
🔥 New notebook just dropped! @amir-naveh , @TomerGoldfriend — come check out this shiny new addition to our repo. |
|
@NadavClassiq please review the PR |
|
Thank you @Tatgithub02 for this contribution. We will review it :-).
Let us know if you have any questions. |
- 12-qubit Hamiltonian: 2257 Pauli strings - Exact evolution reproduces paper Fig. 2 - Classiq Suzuki-Trotter simulation - Validation: conservation laws verified Closes Classiq#580
76f7e60 to
487fa17
Compare
Thanks @TomerGoldfriend ! I've rebased onto the latest main and run pre-commit with the lint fixes committed. Let me know if anything else comes up. |
…sign choices - Explain why custom Pauli algebra is used instead of SparsePauliTerm for Hamiltonian construction (converted to SparsePauliOp for suzuki_trotter) - Move PAULI_MATRICES dict to module level for reuse - Add forward-reference: sparse matrix powers Section 7 exact evolution - Explain motivation for classical Trotter emulation (isolates algorithmic error from shot noise) and reduce Fig 3 to 3 representative curves - Use synthesize(main) directly instead of create_model + synthesize - Replace ExecutionSession with calculate_state_vector (new Classiq API) - Update all downstream code: population_from_state_vector, batch params - Remove shot-noise error bars (state-vector gives exact probabilities) Co-authored-by: Cursor <cursoragent@cursor.com>
|
@TomerGoldfriend I have resolved your queries. For further reviews - please mark the specific parts of code and add comments there. instead of all at top. |
Thank you @Tatgithub02, we will go over the revised version. As for the comments, we work with ReviewNB, which is currently the most reasonable way to review jupyter notebooks. For markdown cells, it is not possible to comment on a specific line. |
Co-authored-by: Cursor <cursoragent@cursor.com>
| @@ -0,0 +1,2149 @@ | |||
| { | |||
There was a problem hiding this comment.
Environment
This notebook was developed and tested withclassiq1.19.1. Execution uses the currentcalculate_state_vectorAPI (older releases used sampling helpers such asbatch_sample/ExecutionSession.sample). The first cell installs dependencies and, on a fresh machine, performs the one-time Classiq authentication.
Run order. Use Restart kernel → Run All before reviewing plots or opening a PR. Section 13 depends on the Classiq time sweep (cell definingpopulations_trotter) finishing before the comparison and deviation plots - out-of-order execution causesNameError: populations_trotter is not defined. The sweep evaluates 41 time points withcalculate_state_vectoron the Classiq simulator (state-vector probabilities; no shot sampling).
You can delete this markdown cell (with the title Environment).
Our repo is always aligned with the classiq version. When new features arrive, we will update your notebook. It is always tested with the most updated classiq version.
Reply via ReviewNB
| @@ -0,0 +1,2149 @@ | |||
| { | |||
There was a problem hiding this comment.
%pip install -U "classiq==1.19.1" numpy scipy matplotlib # import classiq # classiq.authenticate() # one-time browser login on a new machine
You can remove this
Reply via ReviewNB
| @@ -0,0 +1,2149 @@ | |||
| { | |||
There was a problem hiding this comment.
but the author's reference implementation (shared with us directly, and against which this notebook was cross-checked term by term) applies the convention
Do you mean that you have the original paper implementation? it will be nice to run resource comparison between the qiskit implementation and the one with classiq herel; for example, comparing the CX count. This is just a suggestion of course, let me know if you want to do it, then probably we will need to put the qiskit implementation in a separate file, not to overload the notebook.
Reply via ReviewNB
| @@ -0,0 +1,2149 @@ | |||
| { | |||
There was a problem hiding this comment.
Line #4. _PAULI_MUL = {
It is still not clear why can't you use Classiq's built-in SparsePauliOp. First, you can work with openfermion classes (FermionOperator and QubitOperator) and functions (jordan_wigner) , and then transform QubitOperator to qmod by the function qubit_op_to_qmod .
But if you do the Jordan Wigner by yourself, then even openfermion is not necessary, since you can do algebra with SparsePauliOp, like Pauli.X(0)*Pauli.Y(0). Please clarify what is missing.
Reply via ReviewNB
| @@ -0,0 +1,2149 @@ | |||
| { | |||
There was a problem hiding this comment.
Line #2. TROTTER_ORDER = 1 # paper's choice: first-order (second order costs 2x depth)
BTW, classiq compiler gives something which is better than twice the depth.
Reply via ReviewNB
| @@ -0,0 +1,2149 @@ | |||
| { | |||
There was a problem hiding this comment.
Line #1. write_qmod(main, "qft_simulation", decimal_precision=4)
You can remove the write_qmod, it is not required anymore.
Reply via ReviewNB
| @@ -0,0 +1,2149 @@ | |||
| { | |||
There was a problem hiding this comment.
|
@Tatgithub02 please move the notebook to the directory community/paper_implementation_project |
| @@ -1 +1 @@ | |||
| update_notebooks.sh | |||
There was a problem hiding this comment.
what is this change? please do not modify the .internal dir
Co-authored-by: Cursor <cursoragent@cursor.com>
… .internal Relocate the QFT notebook to paper_implementation_project, remove the write_qmod export and placeholder pass cell, qualify Trotter depth wording for Classiq synthesis, and restore .internal/update_outputs/main.sh. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Tatgithub02 what is the status here? did you complete the revised version according to our review? |
|
@TomerGoldfriend I recently got a new job, so was moving and packing, would start working on this tomorrow again! |
Issue
Closes #580
What This Does
Implements the QFT simulation from Section IV.1 of the paper
Simulating Quantum Field Theories on Gate-Based Quantum Computers
by Gayathree M. Vinod and Anil Shaji.
Reproduces Fig. 2 — the oscillatory dynamics of a fermion transitioning
into a fermion-plus-boson pair in a 1+1D Yukawa theory on a 12-qubit register.
Implementation Details
Physics Setup:
Simulations:
expm_multiply(reference)Results
✓ Exact evolution reproduces paper Fig. 2:
✓ Closed-form Rabi validation:
✓ Conservation laws verified:
✓ Gate-based Trotter simulation:
Files Included
Testing
Checklist
research/qft_simulation/.ipynb,.qmodpre-commitbefore commitKey Assumptions
References