✨ Add Dynamic QFT benchmark#926
Open
inesalonsoo wants to merge 10 commits into
Open
Conversation
Signed-off-by: Ines Alonso <168389351+inesalonsoo@users.noreply.github.com>
flowerthrower
requested changes
Jun 16, 2026
flowerthrower
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for your initial draft. I left a few comments. Ideally this benchmark mirrors the original QFT as closely as possible, so any user not familiar with the dynamic version can easily see the correspondence.
| return qc | ||
|
|
||
|
|
||
| def _apply_single_qubit_rotations( |
Collaborator
There was a problem hiding this comment.
This is a really short and simple function. No need for helper functions.
| qc.h(q[qubit_idx]) | ||
|
|
||
| # 3. Collapse the state into the classical register | ||
| qc.measure(q[qubit_idx], c[qubit_idx]) |
Collaborator
There was a problem hiding this comment.
To make it more intutive for other users, could you rename the cl. register and mirror exactly the register associations in the QFT version in. You may inspect the QFT circuit like this.
from mqt.bench import get_benchmark, BenchmarkLevel
# original qft benchmark
circ = get_benchmark("qft", BenchmarkLevel.ALG, circuit_size=4)
circ.decompose().draw("mpl", fold=-1)
Signed-off-by: Ines Alonso <168389351+inesalonsoo@users.noreply.github.com>
Updated test_dynamic_qft_circuit_structure to simplify assertions and improve clarity. Signed-off-by: Ines Alonso <168389351+inesalonsoo@users.noreply.github.com>
Signed-off-by: Ines Alonso <168389351+inesalonsoo@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an implementation of the dynamic_qft benchmark. In this approach, we use mid-circuit measurements and classical feed-forward loops. The design includes a reversed loop progression (reversed(range(num_qubits))) to resolve the bit-reversal mapping and bypass traditional SWAP gate overhead.
Note to Maintainers: I'm fully aware PR #918 is ahead, but I wanted to submit this layout anyway as a personal statement of practice and an opportunity to engage with the Munich Quantum Toolkit codebase.
Fixes #798
Checklist
If PR contains AI-assisted content:
##Verification
I executed local testing successfully inside a local Windows PowerShell virtual environment using the following validation stack:
Set local environment pathing
$env:PYTHONPATH="src"
Execute isolated structural verification tests
python -m pytest tests/test_bench.py::test_dynamic_qft_circuit_structure -v
Output: 4 passed in 5.44s (distributed via xdist)
Verify code styling guidelines
python -m ruff check src/mqt/bench/benchmarks/dynamic_qft.py tests/test_bench.py
python -m ruff format --check src/mqt/bench/benchmarks/dynamic_qft.py tests/test_bench.py