I am trying to resolve a bug in my code. This error is getting generated by an API of qiskit called as qiskit.unitary. The issue is that this method needs a unitary matrix and generates a quantum circuit, which can executed on quantum hardware or simulator or fakeHW. I am cascading the circuit generated by qiskit.unitary with another circuit generated by my algorithm. The unitary matrix generated for qiskit.unitary is calculated by some code and it given as input to qiskit.unitary. If I print the unitary matrix and give it as input to qiskit.unitary, the things work fine as shown: https://colab.research.google.com/drive/1rABdq_1c2EXihEhTMAdElCIZBGc4zJVw?usp=sharing But when I feed the value directly after my calculations, I end up getting the below error: TwoQubitWeylDecomposition:failed to diagonalize M2 Really not sure how to resolve this issue? Just to give explain my question better, for printing the unitary, I put this printoptions: np.set_printoptions(threshold=sys.maxsize, linewidth=2000) Continue reading...