I am a bit confused with my calculation results of SVD for matrix A.
$$ A= \left( \begin{array}{ccc} 4 & 2 & 1\\ 5 & 3 & -10\\ 9 & -12 & 11 \end{array} \right) \\\\ A = UDV^{T} \mbox{ for real matrix} $$
As I know that $U$ contains orthonormal eigenvectors of $AA^{T}$ and $V$ contains orthonormal eigenvectors of $A^{T}A$. Using python I have found eigenvalues and actual SVD:
import numpy as np
A = np.matrix([[4, 2, 1],
[5, 3, -10],
[9, -12, 11]])
# Calculating SVD via eigenvectors
aaeigval, aaeigvec = np.linalg.eig(A*A.T)
ateigval, ateigvec = np.linalg.eig(A.T*A)
MU = aaeigvec
MD = np.diag(np.sqrt(aaeigval))
MV = ateigvec.T
# Calculating SVD via embedded function
U, d, V = np.linalg.svd(A)
D = np.diag(d)
print("SVD MATRICES VIA NP.LINALG.SVD")
print(U)
print(D)
print(V)
print("\r\nSVD MATRICES VIA EIGENVECTORS")
print(MU)
print(MD)
print(MV)
The output is:
SVD MATRICES VIA NP.LINALG.SVD
[[-0.04227372 -0.27992453 -0.95909081]
[ 0.36803649 -0.89680917 0.24552484]
[-0.92884987 -0.34260117 0.1409339 ]]
[[ 19.67398841 0. 0. ]
[ 0. 10.02047314 0. ]
[ 0. 0. 3.67753968]]
[[-0.33996976 0.61836777 -0.70854912]
[-0.86694055 0.08591785 0.4909503 ]
[-0.36446486 -0.78117822 -0.50687863]]
SVD MATRICES VIA EIGENVECTORS
[[-0.95909081 0.27992453 0.04227372]
[ 0.24552484 0.89680917 -0.36803649]
[ 0.1409339 0.34260117 0.92884987]]
[[ 3.67753968 0. 0. ]
[ 0. 10.02047314 0. ]
[ 0. 0. 19.67398841]]
[[-0.33996976 0.61836777 -0.70854912]
[ 0.86694055 -0.08591785 -0.4909503 ]
[ 0.36446486 0.78117822 0.50687863]]
As you can see some columns are flipped but that is not the problem. The problem is in different signs in columns. For instance column 1 of $U$ and column 3 of $MU$ (they have to be the same eigenvector) have different signs at their elements. Of course true decomposition is that of svd function. However I am still missing where I am wrong.