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

Fix __radd__ losing device #2451

Merged
merged 7 commits into from
Nov 20, 2019
Merged

Fix __radd__ losing device #2451

merged 7 commits into from
Nov 20, 2019

Conversation

Strilanc
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Oct 30, 2019
result = Circuit(other)
return result.__iadd__(self)
result = self.copy()
result._moments[:0] = Circuit(other)._moments
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't appear to validate the new moment against the device.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is validating the entire new circuit needed? I would just validate the new moment:

result._moments[:0] = Circuit(other, device=self.device)._moments

Copy link
Collaborator

Choose a reason for hiding this comment

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

There are constraints on operations that can be applied in sequence on the same qubits for certain devices, so validating the whole circuit is necessary to catch that issue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, but Circuit.insert only validates the moment. This is a separate issue from this PR.

cirq/circuits/circuit_test.py Show resolved Hide resolved
Copy link
Contributor Author

@Strilanc Strilanc left a comment

Choose a reason for hiding this comment

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

Validation added and tested.

@Strilanc Strilanc added the Ready for Re-Review For when reviewers take their time. label Nov 7, 2019
result = Circuit(other)
return result.__iadd__(self)
result = self.copy()
result._moments[:0] = Circuit(other)._moments
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is validating the entire new circuit needed? I would just validate the new moment:

result._moments[:0] = Circuit(other, device=self.device)._moments

Copy link
Collaborator

@cduck cduck left a comment

Choose a reason for hiding this comment

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

In that case, LGTM.

result = Circuit(other)
return result.__iadd__(self)
result = self.copy()
result._moments[:0] = Circuit(other)._moments
Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, but Circuit.insert only validates the moment. This is a separate issue from this PR.

@Strilanc Strilanc added automerge Tells CirqBot to sync and merge this PR. (If it's running.) and removed Ready for Re-Review For when reviewers take their time. labels Nov 11, 2019
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Nov 11, 2019
@CirqBot
Copy link
Collaborator

CirqBot commented Nov 11, 2019

Automerge cancelled: A status check is failing.

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Nov 11, 2019
@Strilanc Strilanc added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Nov 18, 2019
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Nov 18, 2019
@CirqBot
Copy link
Collaborator

CirqBot commented Nov 18, 2019

Automerge cancelled: A status check is failing.

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Nov 18, 2019
@Strilanc Strilanc added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Nov 20, 2019
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Nov 20, 2019
@CirqBot CirqBot merged commit 52b14db into master Nov 20, 2019
@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Nov 20, 2019
@CirqBot CirqBot deleted the radd_fix branch November 20, 2019 23:56
@CirqBot CirqBot removed the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants