Skip to content

Computing SVD very slow #12

@filipekstrm

Description

@filipekstrm

Hi. Very interesting work!

I have started exploring the codebase, and found that computing the SVD in the linear inverse scattering problem is very slow, and when trying it took way longer than the 10-20 minutes that the comment indicates (in fact, I let it compute for some 90 minutes before giving up)

However, I found that instead of torch.svd(A) using U, Sigma, Vt = torch.linalg.svd(A, full_matrices=False, driver="gesvd") reduced the time to a mere ~4 minutes (where the use of the driver argument seems to have made the difference). Additionally, I used these results to compute the pseudoinverse instead of torch.linalg.pinv(A). This means the computation of the pseudoinverse takes essentially 0s.

So, first question: did you use torch.svd(A) when computing the SVD initially, and would using my solution above with torch.linalg.svd(A, full_matrices=False, driver="gesvd") be ok?

Second question: is it necessary to use torch.linalg.pinv(A)?

Of course, these computations are only done once, but as the print said that it would take 10-20 minutes and mine wasn't done after 90 minutes, I got curious and thought about how to make it faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions