Implement sparse isometry with binary encoding#435
Open
Conversation
📊 Coverage Summary
Detailed Coverage ReportsC++ Coverage DetailsPython Coverage DetailsPybind11 Coverage Details |
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 7, 2026
| if rank == 0: | ||
| return | ||
|
|
||
| logical_rows = self._apply_unary_staircase(rank) |
Member
There was a problem hiding this comment.
As we discussed, the _apply_unary_staircase can be combined with _ref_to_staircase
YingrongChen
reviewed
Apr 7, 2026
YingrongChen
reviewed
Apr 8, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Implements a new sparse-isometry state preparation path that uses a binary-encoding circuit synthesizer (and corresponding Q# support) to avoid dense state-prep on the reduced subspace.
Changes:
- Add Python binary-encoding synthesizer utilities and a new
sparse_isometry_binary_encodingstate-prep algorithm. - Add/extend Q# utilities to support
MatrixCompressionOp-based expansion ops and binary-encoding state preparation. - Update GF2+X elimination to support forward-only REF output and rename tracked operations to
cx, with expanded/updated test coverage.
Reviewed changes
Copilot reviewed 18 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| python/src/qdk_chemistry/utils/binary_encoding.py | New binary-encoding tableau + synthesizer + operation export layer. |
| python/src/qdk_chemistry/utils/qsharp/src/BinaryEncoding.qs | New Q# runtime support for applying compression ops and binary-encoding state prep. |
| python/src/qdk_chemistry/utils/qsharp/src/StatePreparation.qs | Switch expansionOps to MatrixCompressionOp[] and apply via ApplyMatrixCompressionOp. |
| python/src/qdk_chemistry/utils/qsharp/src/MeasurementBasis.qs | New Q# helper for measuring/resetting in arbitrary Pauli bases. |
| python/src/qdk_chemistry/utils/qsharp/src/IterativePhaseEstimation.qs | New Q# iterative phase estimation circuit helpers. |
| python/src/qdk_chemistry/utils/qsharp/src/ControlledPauliExp.qs | New Q# controlled Pauli exponential helpers for repeated evolution. |
| python/src/qdk_chemistry/utils/qsharp/qsharp.json | New Q# project manifest enumerating Q# source files. |
| python/src/qdk_chemistry/utils/qsharp/init.py | Change Q# init/loading behavior (project-based init; forces Adaptive_RIF). |
| python/src/qdk_chemistry/algorithms/state_preparation/sparse_isometry.py | Update op naming to cx, add forward-only/skip-diagonal-reduction options, and update expansionOps encoding. |
| python/src/qdk_chemistry/algorithms/state_preparation/sparse_isometry_binary_encoding.py | New state-prep algorithm integrating GF2+X (REF) + binary encoding + Q# factory wiring. |
| python/src/qdk_chemistry/algorithms/state_preparation/init.py | Export the new binary-encoding state-prep implementation. |
| python/src/qdk_chemistry/algorithms/registry.py | Register the new SparseIsometryBinaryEncodingStatePreparation algorithm. |
| python/src/qdk_chemistry/init.py | Remove previous global Q# interpreter initialization logic. |
| python/tests/test_utils_binary_encoding.py | New unit tests for binary encoding utilities, tableau ops, and exporter behavior. |
| python/tests/test_state_preparation_binary_encoding.py | New end-to-end tests for the binary-encoding state-prep algorithm (incl. estimator + optional Qiskit statevector checks). |
| python/tests/test_state_preparation.py | Update tests for changed elimination APIs and cx operation naming; add forward-only tests. |
| python/tests/test_circuit.py | Update test data to reflect new expansionOps schema (MatrixCompressionOp dicts). |
| python/tests/test_qdk_interpreter_init.py | Update interpreter init test to match new qsharp utils initialization semantics. |
| python/tests/test_helpers.py | Add helpers to generate physically meaningful random determinant matrices/wavefunctions for tests. |
| examples/state_prep_energy.ipynb | Update example to demonstrate binary-encoding state prep and adjust plotting/simulation details. |
| docs/source/conf.py | Enable Napoleon extension (minor docs config change). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.