Hi,
I wanted to ask if there is a tool in PennyLane that can be used for three-qubit decomposition. Specifically, I have an 8x8 matrix and I would like to decompose it into single-qubit gates using Quantum Shannon Decomposition (QSD) or any other decomposition method.
Hi @Aaqib_Ali ! Pennylane currently has no way to decompose matrices that are larger than 4x4. You could try to create a variational circuit and approximate it as a first approach
Thanks Guillermo for your reply
Can you please elaborate on what the cost function (Fidelity) should be in the context of the circuit?
Good question Assuming you can access the circuit matrix, you could use this:
import numpy as np
A = np.array([[1, 2], [3, 4]])
B = np.array([[1, 2], [3, 5]])
norm_diff = np.linalg.norm(A - B)
There are several definitions of norm that you can choose from by setting the ord
parameter inside the np.linalg.norm
function
1 Like