Skip to content

has_mixture always returning False #1783

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

Closed
Lucaman99 opened this issue Jul 9, 2019 · 3 comments
Closed

has_mixture always returning False #1783

Lucaman99 opened this issue Jul 9, 2019 · 3 comments
Assignees
Labels
area/channels area/protocols/mixtures area/protocols kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@Lucaman99
Copy link
Contributor

When has_mixture is called on a circuit containing mixer gates, a combination of unitary/mixer gates, or exclusively unitary gates, the method seems to always return False as opposed to its has_unitary counterpart, which returns True if and only if a circuit contains exclusively unitary gates.

@Lucaman99 Lucaman99 changed the title has_mixture always returning False has_mixture always returning False Jul 9, 2019
@dabacon
Copy link
Collaborator

dabacon commented May 4, 2020

This is certainly a bug.

@Strilanc I think design for _act_on_ should consider problems like this.

@artvandalay404
Copy link

artvandalay404 commented May 26, 2020

Don't know if this bug still exists? The tests are passing in has_mixture_protocol_test, and it worked for a simple GHZ circuit I ran.

@vtomole vtomole added the triage/discuss Needs decision / discussion, bring these up during Cirq Cynque label Sep 23, 2020
@balopat balopat added the kind/bug-report Something doesn't seem to work. label Sep 25, 2020
@vtomole vtomole added triage/needs-more-evidence [Feature requests] Seems plausible, but maintainers are not convinced about the use cases yet and removed triage/discuss Needs decision / discussion, bring these up during Cirq Cynque labels Oct 13, 2021
@viathor
Copy link
Collaborator

viathor commented Oct 15, 2021

This appears to have been fixed:

In [1]: import cirq

In [2]: q = cirq.LineQubit(0)

In [3]: def f(g):
   ...:     return cirq.has_mixture(g.on(q)), cirq.has_mixture(cirq.Circuit(g.on(q)))
   ...: 

In [4]: f(cirq.S)
Out[4]: (True, True)

In [5]: f(cirq.phase_flip(0.1))
Out[5]: (True, True)

In [6]: f(cirq.phase_damp(0.1))
Out[6]: (False, False)

In [7]: f(cirq.depolarize(0.1))
Out[7]: (True, True)

In [8]: f(cirq.amplitude_damp(0.1))
Out[8]: (False, False)

In [9]: 

Output number six is wrong and I filed #4578 for it. All other outputs are correct (only amplitude damping channel fails to be unital and hence does not admit a mixed-unitary representation). Also, cirq.mixture does fail for the circuits even though has_mixture returns True. Did not file an issue for it since we already have #2382. Also filed #4579 to prevent re-occurrence of these and similar problems (for which we'll have a larger exposure as we increase the number of ways channels can be represented in cirq).

Closing this issue as its core problem is fixed and related problems are covered by the other issues I liked above.

@viathor viathor closed this as completed Oct 15, 2021
@viathor viathor added triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on area/channels and removed triage/needs-more-evidence [Feature requests] Seems plausible, but maintainers are not convinced about the use cases yet labels Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/channels area/protocols/mixtures area/protocols kind/bug-report Something doesn't seem to work. 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

6 participants