Hello all, I'm trying to use the randomized version of scikit-learn's TruncatedSVD (although I'm actually calling the internal function randomized_svd to get the actual u, s, v matrices). While it is working fine for real matrices, for complex matrices I can't get back the original matrix even though the singular values are exactly correct:
>>> import numpy as np >>> from sklearn.utils.extmath import randomized_svd >>> N = 3 >>> a = np.random.rand(N, N)*(1 + 1j) >>> u1, s1, v1 = np.linalg.svd(a) >>> u2, s2, v2 = randomized_svd(a, n_components=N, n_iter=7) >>> np.allclose(s1, s2) True >>> np.allclose(a, u1.dot(np.diag(s1)).dot(v1)) True >>> np.allclose(a, u2.dot(np.diag(s2)).dot(v2)) False Any idea what could be wrong? Thank you! Best regards, Andre Melo _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn