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

Channel testing utilities #4579

Open
viathor opened this issue Oct 15, 2021 · 1 comment
Open

Channel testing utilities #4579

viathor opened this issue Oct 15, 2021 · 1 comment
Assignees
Labels
area/channels area/testing kind/feature-request Describes new functionality triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@viathor
Copy link
Collaborator

viathor commented Oct 15, 2021

Is your feature request related to a use case or problem? Please describe.

Elementary objects in cirq (e.g. quantum gates) are represented as classes with overspecified properties. In other words, they directly provide information that can be computed from other information already available. For example, a quantum gate may provide an implementation of _apply_unitary_ as well as _unitary_ and/or _decompose_. At the same time, we ensure consistency of this information using a number of utilities implemented in cirq.testing. This is a nice approach as it shifts the cost of computation from the user to testing.

With the addition of superoperator and Choi representations of channels to cirq, we will soon have redundant specifications of channels. This calls for suitable consistency checks to be implemented in cirq.testing.

Describe the solution you'd like

We should check that for each channel Kraus, Choi and superoperator representations describe the same channel. We should also implement consistency checks between existing channel-related protocols unitary, kraus and mixture. In addition, the new testing utilities could verify other related properties such as:

[optional] Describe alternatives/workarounds you've considered

[optional] Additional context (e.g. screenshots)

What is the urgency from your perspective for this issue? Is it blocking important work?

P3 - I'm not really blocked by it, it is an idea I'd like to discuss / suggestion based on principle

@viathor viathor added the kind/feature-request Describes new functionality label Oct 15, 2021
@viathor viathor added area/testing area/channels triage/discuss Needs decision / discussion, bring these up during Cirq Cynque labels Oct 15, 2021
@vtomole vtomole added triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on and removed triage/discuss Needs decision / discussion, bring these up during Cirq Cynque labels Nov 3, 2021
@viathor
Copy link
Collaborator Author

viathor commented Dec 8, 2021

The utilities should also validate the behavior of _has_*_ methods.

CirqBot pushed a commit that referenced this issue Oct 13, 2022
Confusion matrix and reset channels both can be viewed as starting with a zero DM tensor and then copying (adding) in scaled slices from the original DM tensor. Thus we make a helper function that does this and add `_apply_channel_` optimizations to those gates.

Fixes #5901.

Starts #5900 though I haven't looked at all gates.

Also starts #4579 but there's likely more to do there as well. I didn't add the new test function to the primary test suite because creating superoperators is likely computationally expensive (granted most if not all gates that use this would be three or fewer qubits, which is still cheap), and the test not relevant for most gates.
rht pushed a commit to rht/Cirq that referenced this issue May 1, 2023
…#5917)

Confusion matrix and reset channels both can be viewed as starting with a zero DM tensor and then copying (adding) in scaled slices from the original DM tensor. Thus we make a helper function that does this and add `_apply_channel_` optimizations to those gates.

Fixes quantumlib#5901.

Starts quantumlib#5900 though I haven't looked at all gates.

Also starts quantumlib#4579 but there's likely more to do there as well. I didn't add the new test function to the primary test suite because creating superoperators is likely computationally expensive (granted most if not all gates that use this would be three or fewer qubits, which is still cheap), and the test not relevant for most gates.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this issue Oct 31, 2024
…#5917)

Confusion matrix and reset channels both can be viewed as starting with a zero DM tensor and then copying (adding) in scaled slices from the original DM tensor. Thus we make a helper function that does this and add `_apply_channel_` optimizations to those gates.

Fixes quantumlib#5901.

Starts quantumlib#5900 though I haven't looked at all gates.

Also starts quantumlib#4579 but there's likely more to do there as well. I didn't add the new test function to the primary test suite because creating superoperators is likely computationally expensive (granted most if not all gates that use this would be three or fewer qubits, which is still cheap), and the test not relevant for most gates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/channels area/testing kind/feature-request Describes new functionality triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on
Projects
None yet
Development

No branches or pull requests

3 participants