Skip to content

✨ Add Dynamic QFT benchmark#926

Open
inesalonsoo wants to merge 10 commits into
munich-quantum-toolkit:mainfrom
inesalonsoo:main
Open

✨ Add Dynamic QFT benchmark#926
inesalonsoo wants to merge 10 commits into
munich-quantum-toolkit:mainfrom
inesalonsoo:main

Conversation

@inesalonsoo

Copy link
Copy Markdown

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

  • [x ] The pull request only contains commits that are focused and relevant to this change.
  • [ x] I have added appropriate tests that cover the new/changed functionality.
  • [ x] I have updated the documentation to reflect these changes.
  • [ x] I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • [ x] I have added migration instructions to the upgrade guide (if needed).
  • [ x] The changes follow the project's style guidelines and introduce no new warnings.
  • [ x] The changes are fully tested and pass the CI checks.
  • [ x] I have reviewed my own code changes.

If PR contains AI-assisted content:

  • [x ] I have disclosed the use of AI tools in the PR description as per our AI Usage Guidelines.
  • [x ] I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.
  • Assisted-by: Gemini AI

##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

inesalonsoo and others added 3 commits June 12, 2026 16:38
@burgholzer burgholzer added feature New feature or request unitaryHACK Issues and PRs intended for unitaryHACK labels Jun 12, 2026

@flowerthrower flowerthrower left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/mqt/bench/benchmarks/dynamic_qft.py Outdated
return qc


def _apply_single_qubit_rotations(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really short and simple function. No need for helper functions.

Comment thread src/mqt/bench/benchmarks/dynamic_qft.py Outdated
qc.h(q[qubit_idx])

# 3. Collapse the state into the classical register
qc.measure(q[qubit_idx], c[qubit_idx])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

inesalonsoo and others added 6 commits June 17, 2026 20:09
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request unitaryHACK Issues and PRs intended for unitaryHACK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Dynamical QFT

3 participants