Skip to content

Choi representation #4132

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

Merged
merged 5 commits into from
May 26, 2021
Merged

Choi representation #4132

merged 5 commits into from
May 26, 2021

Conversation

viathor
Copy link
Collaborator

@viathor viathor commented May 26, 2021

This implements a simple utility for computing the Choi matrix of a channel from its Kraus representation.

Choi representation is more compact than Kraus representations and - unlike the Kraus representation - it is unique for every channel, so we can use this to e.g. compare channels.

The PR is a small step towards #3248. In particular, it does not introduce any new protocols. As discussed on the issue, we might at some point want a protocol to enable channel classes to implement something like __choi__ if there are cases where folks would prefer to specify channels using their Choi matrix rather than the Kraus operators. If we end up doing this, I suppose the protocol will use the utility in this PR to handle channels that provide Kraus operators.

@viathor viathor requested review from cduck, vtomole and a team as code owners May 26, 2021 00:49
@viathor viathor requested a review from 95-martin-orion May 26, 2021 00:49
@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label May 26, 2021
Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

It seems like we may be able to use this to speed up density matrix simulations, since (if I'm reading this correctly) the current implementation must apply each Kraus operator to the state independently.

@viathor
Copy link
Collaborator Author

viathor commented May 26, 2021

@95-martin-orion Each way of representing a channel has its own way of applying it to a density matrix and it's quite likely their costs are different. Also, the cost depends on the channel, e.g. applying unitary/isometric channels using a Kraus representation is probably fairly fast. Applying a channel using its Choi matrix involves transposing the density matrix, tensoring it with identity, multiplying by the Choi and tracing out the input space. It's not immediately clear that this is cheaper. However, a follow-up PR to this is a matrix representation of a channel (aka "the natural representation" in John Watrous' book). In this representation, applying a channel to a density matrix is just matrix multiplication (though the matrices involved are larger). It's quite possible that this would be the fastest way in the worst case.

def choi(operation: 'protocols.SupportsChannel') -> np.ndarray:
"""Returns the unique Choi matrix associated with a superoperator."""
ks = protocols.channel(operation)
d = np.prod(ks[0].shape)
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 extract a kraus_to_choi here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@@ -330,6 +330,7 @@

from cirq.qis import (
bloch_vector_from_state_vector,
choi,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be a more specific name here to avoid future naming conflict? operation_to_choi or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, it does appear we might have a protocol named choi in near future.

@viathor viathor merged commit b28b163 into quantumlib:master May 26, 2021
@viathor viathor deleted the choi branch May 26, 2021 23:16
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants