I'm trying to reproduce some large project that was written in Matlab, using python. I managed to reproduce most of the results, but I have a problem specifically with SVD decomposition. (I'm looking only on the last, V, part.)
In Matlab:
[~, ~, V] = svd([4.719, -17.257, -11.5392; -17.2575, 63.9545, 40.5581; -11.5392, 40.5581, 31.3256]);
This gets me the following V:
-0.2216 0.0241 -0.9748
0.8081 -0.5549 -0.1974
0.5457 0.8316 -0.1035
in numpy:
np.linalg.svd(np.array([[4.71993, -17.2575, -11.539], [-17.257, 63.954, 40.558], [-11.539, 40.558, 31.325]]))[2]
Gets me:
array([[-0.22159139, 0.80814521, 0.54570924],
[ 0.02407525, -0.55491709, 0.83155722],
[ 0.97484237, 0.19740401, 0.10350855]])
Which is transposed (as I think is expected between numpy and matlab) but also different on some minus signs.
even using opencv (cv2) or scipy (even with lapack_driver="gesvd") still gets the same result
scipy.linalg.svd(np.array([[4.71993, -17.2575, -11.539], [-17.257, 63.954, 40.558], [-11.539, 40.558, 31.325]]), lapack_driver="gesvd")[2]
I also tried to transpose the input matrix, which didn't change much.
I understand that both answers are correct. But I really need to get the exact same result to be able to reproduce the project.