Skip to content

Use XorK bloq instead of CNOTs to load data in QROM#1335

Merged
tanujkhattar merged 3 commits intoquantumlib:mainfrom
tanujkhattar:qrom_xork
Aug 22, 2024
Merged

Use XorK bloq instead of CNOTs to load data in QROM#1335
tanujkhattar merged 3 commits intoquantumlib:mainfrom
tanujkhattar:qrom_xork

Conversation

@tanujkhattar
Copy link
Copy Markdown
Collaborator

This improves the readability of the decomposition and reduces the number of subbloqs in the resulting composite bloq. Should also help with #1052

See old and new diagrams generated by the following test code

data1 = np.arange(10)
data2 = np.arange(10) * 100
qrom = QROM.build_from_data(data1, data2)
show_bloq(qrom.decompose_bloq(), 'latex')

Old Diagram:
qrom_old

New Diagram:
qrom_new

@fdmalone
Copy link
Copy Markdown
Collaborator

NIIIICE

Comment thread qualtran/bloqs/data_loading/qrom.py Outdated
yield XorK(QUInt(target_bitsize), data_to_load).on(*target[idx]).controlled_by(
*ctrl_qubits
)
# for q, bit in zip(target[idx], f'{data_to_load:0{target_bitsize}b}'):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out code? OR say equivalent to if it's helpful for readability

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to remove, forgot. Had commented out assuming there would be test failures that I may need to go and debug; fortunately; there were no test failures :)

@tanujkhattar tanujkhattar enabled auto-merge (squash) August 22, 2024 22:01
@tanujkhattar tanujkhattar merged commit ee9913b into quantumlib:main Aug 22, 2024
@mpharrigan
Copy link
Copy Markdown
Collaborator

niiiice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants