Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some cupyx.scipy.signal APIs fall back to NumPy #7761

Closed
takagi opened this issue Jul 27, 2023 · 3 comments · Fixed by #7771
Closed

Some cupyx.scipy.signal APIs fall back to NumPy #7761

takagi opened this issue Jul 27, 2023 · 3 comments · Fixed by #7771
Labels

Comments

@takagi
Copy link
Member

takagi commented Jul 27, 2023

Some scipy.signal APIs depend on numpy.eigvals, which computes the eigenvalues of a general matrix. However, cuSolver only provides the eigenvalue solver of a symmetric (Hermitian) matrix but does not the one of a general matrix. Therefore, the cupyx.scipy.signal counterparts of such APIs are currently implemented by falling back to numpy.eigvals or numpy.roots, which calls numpy.eigvals.

Such APIs include:

See:

@emcastillo
Copy link
Member

Lets add a warning in documentation of these routines regarding device synchronization

@leofang
Copy link
Member

leofang commented Aug 4, 2023

However, cuSolver only provides the eigenvalue solver of a symmetric (Hermitian) matrix but does not the one of a general matrix.

Hi @takagi @ev-br @andfoy I could really pick your brains here regarding the general-matrix eigensolver. Why isn't it possible to rewrite the algorithms such that you generate a Hermitian matrix? What's special here? (Context: On the cuSOLVER side, I learned that there's great hesitation in adding the general solver because there's no serious use case. A lot of eigvals calls were done, in our opinion, only because people either didn't know eigvalsh exists or didn't know their matrix is Hermitian/symmetric by construction. Also, svd might help for a lot of use cases (#6359 (comment)). We would love to know what's missing in this understanding.)

@takagi
Copy link
Member Author

takagi commented Aug 4, 2023

Thanks @leofang for letting my head up. As for numpy.roots, the roots of a polynomial is found as the eigenvalues of its companion matrix, and the matrix is not symmetric/Hermitian.

https://en.m.wikipedia.org/wiki/Companion_matrix

I suppose we need eigenvalues themselves, not just decomposition, so svd may not work.

However, yes, we might use another algorithm for root finding on GPU that does not use eigenvalues.

https://hal.science/hal-02129742/file/880a5bc7-2a3d-4a66-a539-9755508a949b-author.pdf

Also I’ll look into other lines that use eigvals...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants