-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update non-gate quantum ops to have gates #4683
Comments
There's also |
Regarding the disadvantage mentioned: There are many operations which are not gate operations but have a |
With ops you can do |
Related: #1561 |
@tanujkhattar: It looks like |
@tanujkhattar Looking again, I believe the |
This would be useful towards the Cirq 1.0 roadmap item for organizing gate relationships. xref #3242 |
BREAKING CHANGE: PauliStringPhasor no longer inherits from PauliStringGateOperation. Implements PauliStringPhasor in terms of a GateOperation on a new class PauliStringPhasorGate. Mostly involved moving existing functions from the operation to the gate, and then having the operation call those methods under the hood. Closes #1561, xref #4683 @tanujkhattar
BREAKING CHANGE: PauliStringPhasor no longer inherits from PauliStringGateOperation. Implements PauliStringPhasor in terms of a GateOperation on a new class PauliStringPhasorGate. Mostly involved moving existing functions from the operation to the gate, and then having the operation call those methods under the hood. Closes quantumlib#1561, xref quantumlib#4683 @tanujkhattar
@tanujkhattar can you add the pre-1.0 tag to this one? #4705 and #4702 are still pending review. |
I've added it. |
Migrate ArithmeticOperation to ArithmeticGate. As implemented, ArithmeticGate.on(qubits) returns a GateOperation. In other words, ArithmeticGate is completely unrelated to ArithmeticOperation. They can be considered two different ways to do the same thing. This was done in order to enable ArithmeticOperation to be deprecated. Additionally this PR implements QuirkArithmeticGate, deprecating QuirkArithmeticOperation, and rewrites ModularExp as a gate without a deprecation cycle since it's in /examples. The code for ArithmeticGate (and subclasses) is *basically* identical with ArithmeticOperation, except instead of `Sequence[Qid]]`, a quantum register is a `Sequence[int]`, where the int represents the dimension. It implements the _qid_shape_ protocol from this data, and the GateOperation constructor already has logic to ensure the appropriate number/dimension of qubits are applied. Tests are added to that effect. Closes #4683
BREAKING CHANGE: PauliStringPhasor no longer inherits from PauliStringGateOperation. Implements PauliStringPhasor in terms of a GateOperation on a new class PauliStringPhasorGate. Mostly involved moving existing functions from the operation to the gate, and then having the operation call those methods under the hood. Closes quantumlib#1561, xref quantumlib#4683 @tanujkhattar
Migrate ArithmeticOperation to ArithmeticGate. As implemented, ArithmeticGate.on(qubits) returns a GateOperation. In other words, ArithmeticGate is completely unrelated to ArithmeticOperation. They can be considered two different ways to do the same thing. This was done in order to enable ArithmeticOperation to be deprecated. Additionally this PR implements QuirkArithmeticGate, deprecating QuirkArithmeticOperation, and rewrites ModularExp as a gate without a deprecation cycle since it's in /examples. The code for ArithmeticGate (and subclasses) is *basically* identical with ArithmeticOperation, except instead of `Sequence[Qid]]`, a quantum register is a `Sequence[int]`, where the int represents the dimension. It implements the _qid_shape_ protocol from this data, and the GateOperation constructor already has logic to ensure the appropriate number/dimension of qubits are applied. Tests are added to that effect. Closes quantumlib#4683
BREAKING CHANGE: PauliStringPhasor no longer inherits from PauliStringGateOperation. Implements PauliStringPhasor in terms of a GateOperation on a new class PauliStringPhasorGate. Mostly involved moving existing functions from the operation to the gate, and then having the operation call those methods under the hood. Closes quantumlib#1561, xref quantumlib#4683 @tanujkhattar
Migrate ArithmeticOperation to ArithmeticGate. As implemented, ArithmeticGate.on(qubits) returns a GateOperation. In other words, ArithmeticGate is completely unrelated to ArithmeticOperation. They can be considered two different ways to do the same thing. This was done in order to enable ArithmeticOperation to be deprecated. Additionally this PR implements QuirkArithmeticGate, deprecating QuirkArithmeticOperation, and rewrites ModularExp as a gate without a deprecation cycle since it's in /examples. The code for ArithmeticGate (and subclasses) is *basically* identical with ArithmeticOperation, except instead of `Sequence[Qid]]`, a quantum register is a `Sequence[int]`, where the int represents the dimension. It implements the _qid_shape_ protocol from this data, and the GateOperation constructor already has logic to ensure the appropriate number/dimension of qubits are applied. Tests are added to that effect. Closes quantumlib#4683
Describe your design idea/issue
It would be nice to make things consistent such that quantum operations (as opposed to control operation classes like subcircuits and feedforward) all have associated gates. Most do. The ones I see that don't are:
The advantages of doing this are:
Disadvantages:
GateOperation(PauliStringPhasorGate(), q)
is not the same asPauliStringPhasorGate.on(q)
: we still want the latter to return aPauliStringPhasorOperation
because it has extra functionality. So maybe this is confusing.The text was updated successfully, but these errors were encountered: