# Find change of basis to minimize difference between 2 matrices

I have two diagonalizable matrices that are almost equal to eachother, approximately up to a unitary change of basis $C_2 \approxeq U C_1 U^\dagger + \epsilon$. I want to find said unitary matrix (and using an efficient algorithm).

My first thought was using svd decomposition because then: $C_1=U_1 S_1 V_1$ , $C_2=U_2 S_2 V_2$ you could set $U=U_1 U_2^\dagger$ such that $C_1 \approxeq U C_2 U^\dagger$. I think this would converge.

The problem is that my singular values are very small, I'm getting numerical errors when computing the svd decomposition. Is there another algorithm or a trick I could do? For example the QR decomposition is very stable, but I don't know how to solve this problem without either diagonalization (expensive) or svd decomposition (inaccurate).

• What metric do you use? That is what measure for the difference of 2 matrices do you use? – skyking Mar 22 '17 at 14:00
• The frobenius norm of the difference would work. I'm representing these matrices as vectors in my code, and I want the difference of my vectors to be small (in the 2 norm) when matrices are almost unitary equivalent to eachother. – camel Mar 22 '17 at 14:07