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

Redundant implementations of phase damping channel #4578

Open
viathor opened this issue Oct 15, 2021 · 2 comments
Open

Redundant implementations of phase damping channel #4578

viathor opened this issue Oct 15, 2021 · 2 comments
Assignees
Labels
area/channels 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

@viathor
Copy link
Collaborator

viathor commented Oct 15, 2021

Description of the issue

We currently have two implementations of the phase damping channel: cirq.PhaseDampingChannel and cirq.PhaseFlipChannel. They implement the same channel, but use different parametrization. Also, PhaseDampingChannel fails to provide _mixture_ (even though it is unital and hence admits a mixed-unitary representation).

I propose to combine the two channel classes, but keep all existing factories. The constructor of the new class would have to support both parametrizations, but factory functions would each work with one (i.e. as it is presently). This entails deprecating one class name and keeping all function names. The two functions are useful as a convenient interface to the two popular parametrizations of the channel.

How to reproduce the issue

In [35]: cirq.has_mixture(cirq.phase_damp(0.1))
Out[35]: False

In [36]: cirq.has_mixture(cirq.phase_flip(0.1))
Out[36]: True

After the fix both calls above should return True.

Cirq version
You can get the cirq version by printing cirq.__version__. From the command line:

In [38]: cirq.__version__
Out[38]: '0.13.0.dev'
@viathor viathor added the kind/bug-report Something doesn't seem to work. label Oct 15, 2021
@viathor viathor changed the title Two implementations of phase damping channel in cirq Two implementations of phase damping channel Oct 15, 2021
@viathor
Copy link
Collaborator Author

viathor commented Oct 15, 2021

Context: discovered in an attempt to reproduce #1783.

@viathor viathor added triage/discuss Needs decision / discussion, bring these up during Cirq Cynque area/channels labels Oct 15, 2021
@viathor viathor changed the title Two implementations of phase damping channel Redundant implementations of phase damping channel Oct 15, 2021
@tanujkhattar tanujkhattar 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 Oct 20, 2021
@tanujkhattar
Copy link
Collaborator

Notes from sync:

  • Mike: They are also separately listed in N & C but have an exercise asks you to prove they are the same.
  • Dave: There is a difference in how you think about these two channels.
  • Dave: We have other places where this happens.
  • Dave: We could subclass but modifying kraus representations would be non trivial.

We should keep both the classes for now and add mixture representation to PhaseDampingChannel.

@tanujkhattar tanujkhattar added triage/discuss Needs decision / discussion, bring these up during Cirq Cynque and removed triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on labels Oct 20, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/channels 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

4 participants