Add periodic boundary support to banded sparse-access oracles
Maintainers usually reply within 8 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- backend, quantum-computing
Research direction
Start with python/cudaq_algorithms/sparse/_banded.py and the existing banded oracle tests; trace how locations, values, inverses, and normalization are defined. Implement and test the periodic mode against independently assembled quantized circulant matrices, including alias and small-dimension cases. Done means the stated oracle, unitarity, QSVT solve, documentation, and runnable example criteria pass.
Written by the indexing model from the issue text.
Description
banded_oracles currently clips entries that cross the matrix boundary, although its location oracle already computes shifts modulo the register dimension. Add an opt-in periodic mode so constant-coefficient circulant stencils can use SparseOracleEncoding and QSVT through arithmetic oracles, without a per-entry QROM table.
A motivating example is the periodic diffusion-reaction operator
A = (2 + mass) I - S - S.T, where S is a cyclic shift, N = 2**n, and mass > 0 makes the system invertible.
Proposed API
from cudaq_algorithms.sparse import SparseOracleEncoding, banded_oracles
n = 3
mass = 4.0 / 9.0
oracles = banded_oracles(
offsets=[-1, 0, 1],
band_values=[-1.0, 2.0 + mass, -1.0],
num_system=n,
value_bits=8,
boundary="periodic",
)
encoding = SparseOracleEncoding(oracles, num_system=n)
Preserve the current clipped behavior as the default, for example boundary="open". This names the existing band truncation; it does not introduce a general PDE boundary-condition solver.
Implementation considerations
The natural extension point is sparse/_banded.py. The generic SparseOracleEncoding assembler should not need a periodic-specific algorithm.
- Locations: retain the existing modular shift and its explicit inverse.
- Values: periodic bands retain their coefficients across wrap-around instead of being masked to zero.
- Signed entries: compute the
upperbit from the actual wrapped row/column ordering. The current offset-sign rule is valid for clipped bands, but reverses at a periodic boundary. Simply removing the value mask would give incorrect signs for negative wrap-around entries. - Equivalent offsets: define whether offsets congruent modulo
Nare combined or rejected with a clear error. Cover the self-inverse half-period shift and theN=2case, where+1and-1address the same neighbor. Preserve a valid reverse-slot involution. - Contracts: retain clean scratch, zero-valued padded slots, explicit oracle inverses, the existing value-quantization model, and honest normalization/register accounting.
Initially scope this to one-dimensional periodic/circulant matrices. Coordinate-wise periodic boundaries on multidimensional meshes need a separate design; wrapping a flattened index is not equivalent.
Acceptance criteria
- Existing clipped-mode tests and behavior remain unchanged.
- Test periodic location/value oracles and their inverses, including coherent inputs, clean scratch, unused slots, and signed wrap-around entries.
- Compare the good block against an independently assembled quantized circulant matrix divided by the reported normalization; check unitarity and Hermiticity on the supported clean-scratch domain.
- Test the documented policy for offset aliases, half-period shifts, and very small dimensions.
- Add a small QSVT solve of the shifted periodic Laplacian, checked against an independent FFT/classical solution, with matrix-quantization and inverse-polynomial errors accounted for separately.
- Document the option and provide a runnable sparse-access example. Report its register and normalization costs explicitly; it need not match the qubit count of a specialized compact LCU encoding.
- Dominant language
- Python
- Stars
- 19
- Forks
- 18
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 14
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/cudaq-algorithms
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/cudaq-algorithms#110 ·
Maintainers usually reply within 8 days
-
Support negative spin projections in make_hartree_fock_occupationPossibly taken @Schrodingerscat07 claimed this 20 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NVIDIA/cudaq-algorithms#77 · 1 comment ·
Maintainers usually reply within 8 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
NVIDIA/cudaq-algorithms#76 ·
Maintainers usually reply within 8 days
-
`PauliLCU` accepts zero-width Pauli words (and target-free scalar `SpinOperator`s) and builds a `num_system = 0` encodingMay be free again @kubuyuk claimed this 11 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
NVIDIA/cudaq-algorithms#58 · 1 comment ·
Maintainers usually reply within 8 days
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
NVIDIA/cudaq-algorithms#108 ·
Maintainers usually reply within 8 days
All issues in NVIDIA/cudaq-algorithms
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
521xueweihan/HelloGitHub#4729 ·
-
auto-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
needs-triage type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
pollen-robotics/reachy_mini_conversation_app#631 ·
Maintainers usually reply within 7 days
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100