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 LinearCombination block encoding #1133

Merged
merged 7 commits into from
Jul 16, 2024
Merged

Conversation

charlesyuan314
Copy link
Contributor

Add an instance of BlockEncoding that builds a block encoding of the linear combination of its
constituent block encodings, given a list of coefficients.

qualtran/bloqs/block_encoding/linear_combination.py Outdated Show resolved Hide resolved
qualtran/bloqs/block_encoding/linear_combination.py Outdated Show resolved Hide resolved
qualtran/bloqs/block_encoding/linear_combination.py Outdated Show resolved Hide resolved
Comment on lines +111 to +112
Phase(be, phi=1, eps=0) if l < 0 else be
for l, be in zip(self._lambd, self._block_encodings)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this right? we ignore be if its coefficient is less than zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, what do you mean here? If the coefficient is less than zero we use Phase(be, phi=1, eps=0) which negates be, otherwise we use be unmodified.

Copy link
Collaborator

Choose a reason for hiding this comment

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

doh I didn't see that be is being passed to Phase. I thought you were just emitting a GlobalPhase operation and ignoring that entry

@mpharrigan
Copy link
Collaborator

What's the use case of the user providing their own select and prepare?

@charlesyuan314
Copy link
Contributor Author

The use case would be in case the user has more optimized oracles on hand. I think this is something @tanujkhattar mentioned as being useful.

@mpharrigan mpharrigan merged commit cebe529 into quantumlib:main Jul 16, 2024
7 checks passed
@charlesyuan314 charlesyuan314 deleted the lc branch July 16, 2024 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants