Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Hadamard-test circuit generator algorithm (Q# + Qiskit backends) and wires it into the algorithm registry, along with Q# utility code and end-to-end-ish tests using a small water benchmark pipeline.
Changes:
- Introduces
HadamardTestGeneratorabstractions plusQsharpHadamardGenerator/QiskitHadamardGeneratorimplementations. - Adds Q# utility operation
MakeHadamardCircuitand registers it for lazy Q# utils loading. - Registers the new factory/algorithms and adds tests validating observable measurement + input validation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| python/tests/test_hadamard_test_generator.py | New tests + benchmark fixture for Hadamard-test generators (Q# and Qiskit). |
| python/src/qdk_chemistry/utils/qsharp/HadamardTest.qs | New Q# operation for constructing Hadamard test circuits. |
| python/src/qdk_chemistry/utils/qsharp/init.py | Adds the new Q# file to the lazy-loaded utility bundle. |
| python/src/qdk_chemistry/algorithms/registry.py | Registers the new factory + algorithms in the global registry. |
| python/src/qdk_chemistry/algorithms/hadamard_test_generator/hadamard_test_generator.py | Implements Q# and Qiskit Hadamard-test generators. |
| python/src/qdk_chemistry/algorithms/hadamard_test_generator/base.py | Adds base HadamardTestGenerator and HadamardTestFactory. |
| python/src/qdk_chemistry/algorithms/hadamard_test_generator/init.py | Exposes the factory at the package level. |
| python/src/qdk_chemistry/algorithms/init.py | Exports HadamardTestGenerator from the algorithms package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
python/src/qdk_chemistry/algorithms/hadamard_test_generator/hadamard_test_generator.py
Outdated
Show resolved
Hide resolved
python/src/qdk_chemistry/algorithms/hadamard_test_generator/hadamard_test_generator.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Adds a new “Hadamard test generator” algorithm type with Q# and Qiskit-backed implementations, wires it into the algorithm registry, and introduces integration tests + Q# utility code to build the corresponding circuits.
Changes:
- Introduce
HadamardTestGenerator+ factory, plusQsharpHadamardGenerator/QiskitHadamardGeneratorimplementations. - Register the new algorithm type and default implementations in the central registry and algorithm exports.
- Add Q# utility operation (
MakeHadamardCircuit) and a new Python integration test module that validates expectations on a water benchmark.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/src/qdk_chemistry/algorithms/hadamard_test_generator/base.py | Adds abstract generator + factory for the new algorithm type. |
| python/src/qdk_chemistry/algorithms/hadamard_test_generator/hadamard_test_generator.py | Implements Q# and Qiskit Hadamard-test circuit generators. |
| python/src/qdk_chemistry/algorithms/hadamard_test_generator/init.py | Exposes the factory for registry integration. |
| python/src/qdk_chemistry/algorithms/registry.py | Registers the new factory and built-in generator instances. |
| python/src/qdk_chemistry/algorithms/init.py | Exports HadamardTestGenerator in the public algorithms API surface. |
| python/src/qdk_chemistry/utils/qsharp/HadamardTest.qs | Adds Q# operation to construct a Hadamard test circuit in X/Y/Z bases. |
| python/src/qdk_chemistry/utils/qsharp/init.py | Ensures the new Q# file is loaded via the Q# utils lazy loader. |
| python/tests/test_hadamard_test_generator.py | Adds integration tests for Q# and Qiskit generators + input validation tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return "hadamard_test_generator" | ||
|
|
||
| def default_algorithm_name(self) -> str: | ||
| """Return the hadamard_test as default algorithm name.""" |
| Raises: | ||
| ModuleNotFoundError: If Qiskit is not installed. | ||
| """ |
| Adjoint S(control_q); | ||
| H(control_q); | ||
| } elif (testBasis != "Z") { | ||
| fail "Invalid measurement basis."; |
| if test_basis == "X": | ||
| circuit.h(control) | ||
| elif test_basis == "Y": | ||
| circuit.sdg(control) | ||
| circuit.h(control) | ||
| elif test_basis != "Z": # if it is "Z", then do nothing; otherwise, raise error | ||
| raise ValueError(f'Invalid value for test_basis: {test_basis!r}. Allowed values are "X", "Y", and "Z".') | ||
| circuit.measure(control, classical[0]) |
📊 Coverage Summary
Detailed Coverage ReportsC++ Coverage DetailsPython Coverage DetailsPybind11 Coverage Details |
No description provided.