Skip to content

Conversation

@mpharrigan
Copy link
Collaborator

Add the controlled-Z CZ gate

@mpharrigan mpharrigan requested a review from tanujkhattar July 9, 2024 00:59
@mpharrigan
Copy link
Collaborator Author

I need to hook this up to the docs system, marking as draft

@mpharrigan mpharrigan marked this pull request as draft July 9, 2024 01:13


@frozen
class CZ(Bloq):
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://github.com/quantumlib/Qualtran/pull/1115/files adds a CYGate whereas this PR adds a CZ gate. Let's keep the CX / CY / CZ family's name consistent -- let's either add CPGate or CP where P is the pauli in question.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My original motivation was to use CNOT and CZ for those two gates since those are very common names. I.e. folks would expect to find a CNOT bloq and a CZ bloq through tab completion or searching the docs site. CY just doesn't feel as common to me, although I take the point on the consistency angle. But I really don't want to change CNOT to be CX.


@cached_property
def signature(self) -> 'Signature':
return Signature.build(q1=1, q2=1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we just accept Signature([Register('q', QBit(), shape=2)]) instead of a q1 and q2 ? This will keep things consistent with rotation bloqs deriving from CirqGateAsBloqBase. We can also follow the same pattern for 3 qubit gates instead of q1, q2, q3 etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll make the change in the other pr's to be ctrl and target. Conceivably, that could be the case here as well; but CZ is symmetric.

@mpharrigan mpharrigan marked this pull request as ready for review July 18, 2024 23:23
@mpharrigan mpharrigan enabled auto-merge (squash) July 20, 2024 00:17
@mpharrigan mpharrigan merged commit b0d4840 into quantumlib:main Jul 20, 2024
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.

2 participants