-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Quantum shannon decomposition fails for QFT with non-unitary matrix error #6666
Comments
csynque meeting - we need to confirm this fails due to significant difference rather than round-off errors. |
related to #6725 @pavoljuhas it seems that |
@NoureldinYosri I would say this is a good opportunity to rewrite how cirq does QSD for two reasons:
It would be great if you can just replicate what Qiskit has for your QSD. I'd be more than happy to help where I can. Here's a reference for QSD through qiskit vs through cirq (let's assume it's fixed):
|
@ACE07-Sev QSD was a recent addition to Cirq and we welcome help with this and other issues. if you (or someone else) would like to help fix this, feel free to assign the issue to yourself and we would be very grateful. otherwise we will discuss this issue in the next cirq-sync. |
May I ask how I can get added to the meeting for this? I had a look at the cirq-dev google group, but I can't see any scheduled meetings there. |
@ACE07-Sev when you join https://groups.google.com/g/cirq-dev, you get automatic invitation to the meeting |
I didn't get any invites hehe, it's ok I'll try to follow from the issue discussion. |
@ACE07-Sev I can add you, what is your email? |
That would be wonderful. My email is amiralimlk07@gmail.com. |
looks like I can't, the event is for members of the group. make sure you followed the steps in https://github.com/quantumlib/Cirq/blob/ce1d9035e878f1f2f73e6ef9575f522bd180665f/docs/dev/rfc_process.md#how-to-submit-an-rfc if this doesn't work you can join tomorrow at 10am pst through https://meet.google.com/www-wuvf-jjb |
cirq-sync: @ACE07-Sev do you want to take this task? |
Greetings there, Hope you are well. Sorry for the delay, I am working on it but not sure when I'll reach the fix. |
@ACE07-Sev just checking if there are any updates? |
@NoureldinYosri Greetings, Hope you are well. Not yet, I have been working on the QASM conversion issue. I saw your new commit, I'll have a look at that to catch up. |
This PR: - fixes how `_single_qubit_decomposition` handles global phase and reduces the number of operations it returns when possible. - Makes the eigendecomposition part resilient to numerical precision issues by: 1. resorting to the more accurate`eigh` instead of `eig` when the unitary is hermitian. 2. if the unitary is not hermitian then use Gram–Schmidt to make sure the eigenvectors are orthonormal (mathematically they should but we could get non orthognoal vectors either because of numerical precision or because an eigenvector is repeated and as a result the the eigenvector spanning that subspace are arbitary) - Reduce the number of operations by removing operations equaivalent to identity (e.g. rz($\phi$) with $\phi \approx 0$) - Adds tests for the reported failures making sure they are fixed. - Adds tests for the corner cases of the decomposition. --- update: also add `two_qubit_matrix_to_cz_operations` and `three_qubit_matrix_to_operations` as base cases to reduce the depth of the circuit. --- fixes quantumlib#6666 fixes quantumlib#6725
Description of the issue
I encountered an issue when attempting to decompose the unitary matrix of QFT(4) using the built-in
quantum_shannon_decomposition
function in Cirq.According to the documentation, the
quantum_shannon_decomposition
function is supposed to decompose the unitary matrix into a sequence of CX, YPow, ZPow, and CNOT gates. However, it seems that the result of the decomposition contains a non-unitary matrix.How to reproduce the issue
Cirq version
1.4.1
The text was updated successfully, but these errors were encountered: