[Python] Why is Matrix Multiplication Slow During Pseudoinverse Calculation?

Discussão em 'Python' iniciado por Stack, Julho 8, 2025.

  1. Stack

    Stack Membro Participativo

    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...

Compartilhe esta Página