-
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
Gate.on().gate should be consistent #2626
Comments
I've tried this refactor and indeed run into problems with ControlledOperation and PauliString. These feel like signs that these operations are not properly designed. |
I'm not sure if this is possible any more, but pre 1.0 should dedide if we want to do this. |
I'd looked at this and it would be a pretty big change. Alternately, we may want a consistency test that |
OK so if we reduce the scope to testing this, I think the challenge is going to be generating instances of all of the gates. I thought about using the json test data for this, anyone have a better idea? |
Adding discuss label to see if we want to do this. Given the comments and the corresponding difficulty of deprecating TaggedOperations, I think this is too big of an issue (with not as much benefit) to tackle before 1.0. As suggested above, we could limit the scope to adding consistency that |
#5354 adds tests for round tripping. There is at least one more gate that needs to be serialized to get complete coverage. |
Closing this issue as gates without json serialization is tracked in #5353 |
Right now the return type of
Gate.on
isOperation
, notGateOperation
. I have come across situations where I want to assume that the result ofGate.on
has a non-None
gate
attribute. This should be a safe assumption, but the types currently don't work out.Changing the return type of
Gate.on
fromOperation
toGateOperation
results in the following mypy errors:I think the only tricky ones here are DensePauliString and ControlledGate. DensePauliString can be fixed by making PauliString a GateOperation. ControlledGate can be fixed by defining ControlledGateOperation. It makes sense to have both ControlledOperation and ControlledGateOperation given that both Operation and GateOperation exist.
The text was updated successfully, but these errors were encountered: