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
Hyper-efficient unitary diamond distance #12343
base: main
Are you sure you want to change the base?
Conversation
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
Is this ready for review? If not, please convert it to a draft PR. |
Hi Kevin, I'm pretty happy with it as is. Went through the CONTRIBUTING.md document and hopefully checked off everything. Would be great if someone with more experience contributing could go through it quickly (only a couple changes). All tests and lifting are passing on my machine using tox. |
Pull Request Test Coverage Report for Build 9016815724Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I look forward to seeing the proof of this result.
In general I think it makes more sense to make this function a more general diamond_distance
function with a specialized efficient case for two unitary inputs (like we have specialized cases for fidelity and other functions with unitary inputs), and the general case can be a call to the existing diamond_norm
function.
self.skipTest("CVXPY not installed.") | ||
|
||
rng = np.random.default_rng(1234) | ||
op1 = random_unitary(2**num_qubits, seed=rng) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these tests aren't too slow it it might be nice to add a loop here to run over a bunch of random unitaries rather than just 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my machine it takes around 5.22s to evaluate the diamond norm for 3 qubit channels. Maybe we can run over a bunch of unitaries when num_qubits < 3 and only run one test otherwise?
self.assertAlmostEqual(unitary_diamond_distance(op1, op2), target, places=7) | ||
|
||
@combine(num_qubits=[1, 2, 3]) | ||
def test_unitary_diamond_distance_random(self, num_qubits): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be good to add some random unit tests for comparing random cliffords, and random paulis for the new function to the diamond norm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious what this adds at the moment. Perhaps if optimisations are added in the future for Pauli channels or Cliffords this would make sense... But to be honest, I can't think of a simple optimisation for Clifford circuits (please let me know if you have something in mind).
Hi Chris! Thanks for the comments, and I completely agree, it makes more sense to generalise the function to all CPTP channels. Regarding the proof, I'm quite happy to send it to you, however, it is part of a dissertation submitted for examination and shouldn't be circulated for the time being. Shall I send it to your IBM email? I'll make the changes you outlined ASAP. |
Summary
Adds a new method
unitary_diamond_distance
toqiskit.quantum_info.operators.measures
. This method implements a trick discussed in [1] for calculating the diamond norm (completely bounded trace norm) of a difference of unitary channels (also known as the diamond distance). The implementation is composed of three steps:channel1
=channel2
=Refer to issue #12341 for more details.
Citations
[1] D. Aharonov, A. Kitaev, and N. Nisan, “Quantum circuits with mixed states,” in Proceedings of the thirtieth annual ACM symposium on Theory of computing, pp. 20–30, 1998.
fixes #12341