Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multi-indexed data loading for both QROM and SelectSwapQROM #108

Closed
tanujkhattar opened this issue Nov 14, 2022 · 5 comments · Fixed by #986
Closed

Add support for multi-indexed data loading for both QROM and SelectSwapQROM #108

tanujkhattar opened this issue Nov 14, 2022 · 5 comments · Fixed by #986
Assignees
Labels

Comments

@tanujkhattar
Copy link
Collaborator

Unary iteration now supports writing nested for-loops by iterating over multiple qubit registers, each of different lengths. This support should be extended to QROM so that we can load, for example, data[i][j] in the target register when selection registers store i and j.

  • For QROM, this should be trivial to extend.
  • For SelectSwapQROM, we need to choose a parameter $k_{i}$ for each nested for-loop and then load $N_{i} / k_{i}$ elements using QROM and do swaps correctly for each loaded batch. See Appendix G of https://arxiv.org/pdf/2011.03494.pdf for more details.
@tanujkhattar tanujkhattar self-assigned this Nov 14, 2022
@mpharrigan
Copy link
Collaborator

We also need multi-indexed selectedmajoranafermion and applygatetolthqubit for #107

@mpharrigan
Copy link
Collaborator

Is this done?

@fdmalone
Copy link
Collaborator

fdmalone commented May 8, 2024

QROM yes (I think). For SelectSwapQROM where I've seen this in the literature they typically form a contiguous index from the multi index and do 1D array access if I'm reading this correctly. Although now that I write this I would assume QROM would also incur a contiguous index formation cost...

@tanujkhattar
Copy link
Collaborator Author

For SelectSwapQROM where I've seen this in the literature they typically form a contiguous index from the multi index and do 1D array access if I'm reading this correctly

@fdmalone The additional cost for computing a contiguous register is required only for the cases where one of the selection indices depends upon the other. For example

for i in range(N):
    for j in range(i):
        # Load data[i][j] ==> This requires computing a contiguous register
for i in range(N):
    for j in range(M):
        # Load data[i][j] ==> This DOES NOT require computing a contiguous register

QROM supports the second case, SelectSwapQROM does not. Appendix G of the linked THC paper explains how to do this for SelectSwapQROM

@fdmalone
Copy link
Collaborator

fdmalone commented May 8, 2024

thanks, I always found that appendix confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants