Skip to content

Conversation

@Strilanc
Copy link
Contributor

@Strilanc Strilanc commented Jun 5, 2020

Handy to have around when building circuits up in tiled pieces and wanting to guarantee the moment structure comes out right.

@Strilanc Strilanc requested review from dabacon and dstrain115 June 5, 2020 17:50
@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Jun 5, 2020
Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

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

Just one small comment then LGTM.

assert cirq.Circuit().zip(cirq.Circuit(cirq.Moment())) == cirq.Circuit(
cirq.Moment())

assert circuit1.zip(circuit2) == circuit2.zip(circuit1) == cirq.Circuit(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want to have a line comment above this and below here, since there is a heading above for empty cases, but it is not visually clear where the section of "Empty cases" ends.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Strilanc Strilanc added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 7, 2020
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 7, 2020
@CirqBot CirqBot merged commit 8cc7d93 into master Jun 8, 2020
@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 8, 2020
@CirqBot CirqBot deleted the zip_circuits branch June 8, 2020 00:10
@CirqBot CirqBot removed the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 8, 2020
>>> circuit1 = cirq.Circuit(cirq.H(a), cirq.CNOT(a, b))
>>> circuit2 = cirq.Circuit(cirq.X(c), cirq.Y(c), cirq.Z(c))
>>> circuit3 = cirq.Circuit(cirq.Moment(), cirq.Moment(cirq.S(d)))
>>> print(circuit1.zip(circuit2))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Having this as an instance method feels strange because this isn't how it is done in python?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a bit unusual but makes sense to me. Because of how Python binds methods, both Circuit.merge(c1, c2) and c1.merge(c2) will work.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just start getting scared when we hit line 1269 in a single class definition :)

tonybruguier pushed a commit to tonybruguier/Cirq that referenced this pull request Aug 23, 2020
Handy to have around when building circuits up in tiled pieces and wanting to guarantee the moment structure comes out right.
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.

6 participants