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

ControlledAddOrSubtract Bloq #1145

Merged
merged 14 commits into from
Jul 23, 2024

Conversation

anurudhp
Copy link
Contributor

@anurudhp anurudhp commented Jul 17, 2024

Has half the T-cost of a controlled addition gate. Useful to perform an Rz rotation via addition into phase gradient, at half the cost of a ZPow.

@anurudhp anurudhp force-pushed the 2024/07/12-controlled-add-sub branch from c4876ad to f4ffb02 Compare July 17, 2024 00:47
@anurudhp anurudhp mentioned this pull request Jul 17, 2024
@tanujkhattar tanujkhattar self-assigned this Jul 17, 2024
@anurudhp anurudhp force-pushed the 2024/07/12-controlled-add-sub branch from 4830b4d to 6f501e1 Compare July 17, 2024 19:52
@anurudhp anurudhp force-pushed the 2024/07/12-controlled-add-sub branch from 3625e6d to 96ca306 Compare July 19, 2024 17:46
@anurudhp anurudhp requested a review from tanujkhattar July 19, 2024 17:47
Comment on lines +533 to +534
ctrls, x = bb.add_t(bloq, ctrls=np.asarray(ctrl_soqs), **in_soqs)
return np.asarray(ctrls).tolist(), (x,)
Copy link
Collaborator

Choose a reason for hiding this comment

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

was this a bug? is there a test that would have caught it?

actually: what's going on here? the conditions above exclude any situation in where there is more than one SoquetT being passed in. For this bloq, that one SoquetT is an array of soquets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It fails on test_tensor:

            for li in reg.all_idxs():
>               idxed_soq = in_soq[li]
E               IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

@mpharrigan
Copy link
Collaborator

Some nits but LGTM, but I'll let @tanujkhattar take a final look

Copy link
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

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

LGTM % nits

@mpharrigan mpharrigan enabled auto-merge (squash) July 23, 2024 17:41
@mpharrigan mpharrigan merged commit 5875f8c into quantumlib:main Jul 23, 2024
8 checks passed
@anurudhp anurudhp deleted the 2024/07/12-controlled-add-sub branch July 23, 2024 18:25
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.

3 participants