X, Z, YT = sp.linalg.svds(W, k=353, which='LM') U = YT.transpose() @ np.diag(Z) @ X.transpose() Where W is a sparse CSR matrix of size (124956, 124956). The matrix multiplication to compute U takes a very long time. However, when I generate the same size matrices X, Z, and YT randomly and use the same formula to compute U, the calculation is much faster. I would like to understand why this is happening. How can I speed up the calculation in the above code? Continue reading...