Sparse matrix
A sparse matrix is a matrix where most the values are zero. The proportion of zero elements to non-zero elements is called the sparsity of the matrix. The opposite of a sparse matrix, where most its values are non-zero, is called a dense matrix.
Sparse matrices are used by scientists and engineers when solving partial differential equations. For example, a measurement of a matrix's sparsity can be useful when developing theories about the connectivity of computer networks. When using large sparse matrices in a computer program, it is important to optimize the data structures and algorithms to realize most values are zero.
Sparse matrix example
Here is an example of a 4 x 4 matrix containing 12 zero values and 4 non-zero values, giving it a sparsity of 3:
[[5, 0, 0, 0],
[0, 11, 0, 0],
[0, 0, 25, 0],
[0, 0, 0, 7]]