Python eigenvectors: differences among numpy.linalg, scipy.linalg and scipy.sparse.linalg

后端 未结 2 2130
半阙折子戏
半阙折子戏 2021-02-04 02:48

Scipy and Numpy have between them three different functions for finding eigenvectors for a given square matrix, these are:

  1. numpy.linalg.eig(a)
  2. scipy.linalg
2条回答
  •  半阙折子戏
    2021-02-04 03:10

    Here's an answer the non-routine specific part of your question:

    In principle, the NumPy and SciPy linalg() routines should be the same. Both use LAPACK and BLAS routines internally. The implementation in `´scipy.sparse`` uses a specific algorithm that works well for sparse matrices (ie. a matrices with mostly zero entries). Do not use this if your matrix is dense.

    Note that technically, the eig() in SciPy/NumPy be different implementations due to the fact that both packages can be built with different implementations of Lapack/BLAS. Common choices here would be standard Lapack/BLAS as available from netlib, ATLAS, Intel MKL or OpenBLAS.

提交回复
热议问题