SciPy Utilities

Learn about sparse matrix operations, linear and spline interpolation, and curve fitting in SciPy.

Sparse matrices

A sparse matrix is a matrix in which most of the elements are zero. By contrast, if most of the elements are nonzero, then the matrix is considered dense. The number of zero-valued elements divided by the total number of elements—for example, mnm*n for an m×nm × n matrix—is called the sparsity of the matrix.

Sparse matrices are incredibly useful in scientific computing, where they can provide significant computational and storage efficiencies. Many large-scale systems give rise to mathematical models that operate with sparse matrices. For example, the adjacency matrix of a graph is sparse if the graph has only a small number of edges. Similarly, in matrix factorization-based recommendation engines, the user-item rating matrices are sparse because not all users have rated all movies in the corpus. ...