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

Superoperator protocol #4545

Closed
wants to merge 4 commits into from
Closed

Conversation

viathor
Copy link
Collaborator

@viathor viathor commented Oct 3, 2021

No description provided.

@viathor viathor requested review from cduck, vtomole and a team as code owners October 3, 2021 22:19
@viathor viathor requested a review from dstrain115 October 3, 2021 22:19
@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Oct 3, 2021
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Oct 3, 2021
Comment on lines +115 to +118
so_getter = getattr(val, '_superoperator_', None)
so_result = NotImplemented if so_getter is None else so_getter()
if so_result is not NotImplemented:
return so_result
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to the bugs in kraus and mixture, this will also not work well with decompose. For example:

class A(cirq.SingleQubitGate):
    def _superoperator_(self):
        return self.super_op

class B(cirq.TwoQubitGate):
    def _decompose_(self, qubits):
        return [A().on(q) for q in qubits]

To support constructing superoperator of B using superoperator of A, we'll need to implement the logic which looks at the decomposed operations and their corresponding cirq.superoperator(op) and uses them to reconstruct the super operator of val.

This was left out as part of implementing kraus and mixture and these bugs are currently being fixed in #4486.

Can you please add the logic of combining superoperators of decomposed operation to reconstruct the superoperator of the current operation? If not, can we document that recursive reconstruction is not supported?

@tanujkhattar tanujkhattar self-assigned this Oct 4, 2021
@viathor viathor mentioned this pull request Oct 4, 2021
@github-actions github-actions bot added the Stale label Feb 15, 2024
@github-actions github-actions bot closed this Mar 17, 2024
@mhucka mhucka added the status/stale This has been closed due to inactivity for an extended period of time. label Nov 18, 2024
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. size: L 250< lines changed <1000 status/stale This has been closed due to inactivity for an extended period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants