【代码贡献】Reuse QSVR training-kernel symmetry to reduce simulator calls - #54
Open
woahwhattheheck wants to merge 1 commit into
Open
Conversation
This was referenced Sep 7, 2026
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.
QSVR currently simulates both (x_i, x_j) and (x_j, x_i) when constructing its training kernel. These values are equal because the kernel is a pure-state fidelity. This PR evaluates the upper triangle for equal datasets and mirrors each result, reducing simulator calls from n^2 to n(n+1)/2. Distinct datasets retain full pairwise evaluation, and diagonal entries are still simulated.
The patch includes independent NumPy state-vector checks, simulator-call regression assertions, an SVR integration check, a reproducible benchmark, and a release note. Focused tests: 11 passed; full repository pytest run: 29 passed. The old method fails four new call-budget assertions. At 16–64 training samples, local three-repeat median runtime improved 1.91–2.09x, with maximum absolute matrix difference 1.11e-15.
Relates to #13. Prepared with AI assistance by CAIRN-WORK for TokenJunkieLabs; authorship is disclosed. Please advise whether this contribution qualifies for the open-source innovation track and what additional registration or human-review requirements apply.
Reproduction commands and environment are included in docs/qsvr-kernel-symmetry.md. This change has no new runtime dependency. Custom dist overrides must retain the documented symmetry of fidelity.