Closed ACE07-Sev closed 3 weeks ago
If I print the unitary for the circuit
, it's actually
array([[nan+nanj, nan+nanj, nan+nanj, nan+nanj],
[nan+nanj, nan+nanj, nan+nanj, nan+nanj],
[nan+nanj, nan+nanj, nan+nanj, nan+nanj],
[nan+nanj, nan+nanj, nan+nanj, nan+nanj]])
Which explains the error.
@uzzzzzzz Can you kindly have a look please? I saw that you made the original commit for quantum_shannon_decomposition.py
. I have tried a few random circuits, all fail, and give either the AssertionError
as the result has nan values only, or they raise the ValueError
for non-unitary matrix as .msb_demuxer()
creates a non-unitary matrix and sends that to .quantum_shannon_decomposition()
.
You can try both cases for reproducibility:
AssertionError
: GHZ state, or H(0) Y(1) state with two qubits.ValueError
: Uniform superposition state, basically Hadamard layer on all qubits.I understand why the tests have passed before, as the code runs with unitarygroup.rvs(2**num_qubits)
.
So, I implemented this natively on my side, and was able to get past the nan
error, but still have the AssertionError
problem. It's kind of confusing, it works for certain unitaries, and then for certain unitaries it doesn't.
I tried the following circuit, which is one of the cases that doesn't return the correct value (whilst for randomly generated unitaries, it works fine). A 4 qubit circuit with CX(0, 1) and CX(0, 2).
Description of the issue
Greetings there,
Hope all are well. I was trying the
quantum_shannon_decomposition()
function, and noticed that it doesn't work for the GHZ unitary matrix.How to reproduce the issue
Cirq version cirq == 1.4.1