SciPy SVD vs. Numpy SVD

自闭症网瘾萝莉.ら 提交于 2019-12-10 02:45:14

问题


Both SciPy and Numpy have built in functions for singular value decomposition (SVD). The commands are basically scipy.linalg.svd and numpy.linalg.svd. What is the difference between these two? Is any of them better than the other one?


回答1:


Apart from the error checking, the actual work seems to be done within lapack both with numpy and scipy.

Without having done any benchmarking, I guess the performance should be identical.




回答2:


From the FAQ page, it says scipy.linalg submodule provides a more complete wrapper for the Fortran LAPACK library whereas numpy.linalg tries to be able to build independent of LAPACK.

I did some benchmarks for the different implementation of the svd functions and found scipy.linalg.svd is faster than the numpy counterpart:

However, jax wrapped numpy, aka jax.numpy.linalg.svd is even faster:

Full notebook for the benchmarks are available here.



来源:https://stackoverflow.com/questions/32569188/scipy-svd-vs-numpy-svd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!