All Topics  
Sparse matrix

 

   Email Print
   Bookmark   Link






 

Sparse matrix



 
 
In the mathematical
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
 subfield of numerical analysis
Numerical analysis

Numerical analysis is the study of algorithms for the problems of continuous mathematics .One of the earliest mathematical writings is the Babylonian tablet YBC 7289, which gives a sexagesimal numerical approximation of , the length of the diagonal in a unit square....
 a sparse matrix is a matrix
Matrix (mathematics)

In mathematics, a matrix is a rectangular array of numbers, as shown at the right. In addition to a number of elementary, entrywise operations such as matrix addition a key notion is matrix multiplication....
 populated primarily with zeros .

Conceptually, sparsity corresponds to systems which are loosely coupled. Consider a line of balls connected by springs from one to the next; this is a sparse system. By contrast, if the same line of balls had springs connecting every ball to every other ball, the system would be represented by a dense matrix.






Discussion
Ask a question about 'Sparse matrix'
Start a new discussion about 'Sparse matrix'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In the mathematical
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
 subfield of numerical analysis
Numerical analysis

Numerical analysis is the study of algorithms for the problems of continuous mathematics .One of the earliest mathematical writings is the Babylonian tablet YBC 7289, which gives a sexagesimal numerical approximation of , the length of the diagonal in a unit square....
 a sparse matrix is a matrix
Matrix (mathematics)

In mathematics, a matrix is a rectangular array of numbers, as shown at the right. In addition to a number of elementary, entrywise operations such as matrix addition a key notion is matrix multiplication....
 populated primarily with zeros .

Conceptually, sparsity corresponds to systems which are loosely coupled. Consider a line of balls connected by springs from one to the next; this is a sparse system. By contrast, if the same line of balls had springs connecting every ball to every other ball, the system would be represented by a dense matrix. The concept of sparsity is useful in combinatorics
Combinatorics

Combinatorics is a branch of pure mathematics concerning the study of Countable set objects. It is related to many other areas of mathematics, such as algebra, probability theory, ergodic theory and geometry, as well as to applied subjects in computer science and statistical physics....
 and application areas such as network theory
Network theory

Network theory is an area of applied mathematics and part of graph theory. It has application in many disciplines including particle physics, computer science, biology, economics, operations research, and sociology....
, of a low density of significant data or connections.

Huge sparse matrices often appear in science
Science

In its broadest sense, science refers to any systematic knowledge or practice. In its more usual restricted sense, science refers to a system of acquiring knowledge based on scientific method, as well as to the organized body of knowledge gained through such research....
 or engineering
Engineering

Engineering is the discipline and profession of applying Technology and science knowledge and utilizing natural laws and physical resources in order to design and implement materials, structures, machines, devices, systems, and process that safely realize a desired objective and meet specified criteria....
 when solving partial differential equation
Partial differential equation

In mathematics, partial differential equations are a type of differential equation, i.e., a Relation involving an unknown Function of several independent variables and its partial derivatives with respect to those variables....
s.

When storing and manipulating sparse matrices on a computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
, it is beneficial and often necessary to use specialized algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
s and data structure
Data structure

A data structure in computer science is a way of storing data in a computer so that it can be used efficiently. It is an organization of mathematical and logical concepts of data....
s that take advantage of the sparse structure of the matrix. Operations using standard matrix structures and algorithms are slow and consume large amounts of memory when applied to large sparse matrices. Sparse data is by nature easily compressed
Data compression

In computer science and information theory, data compression or source coding is the process of encoding information using fewer bits than an code representation would use through use of specific encoding schemes....
, and this compression almost always results in significantly less memory
Computer storage

Computer data storage, often called storage or memory, refers to computer components, devices, and recording medium that retain digital data used for computing for some interval of time....
 usage. Indeed, some very large sparse matrices are impossible to manipulate with the standard algorithms.

Storing a sparse matrix


The naive data structure
Data structure

A data structure in computer science is a way of storing data in a computer so that it can be used efficiently. It is an organization of mathematical and logical concepts of data....
 for a matrix is a two-dimensional array. Each entry in the array represents an element ai,j of the matrix and can be accessed by the two indices i and j. For an m×n matrix we need at least enough memory to store (m×n) entries to represent the matrix.

Many if not most entries of a sparse matrix are zeros. The basic idea when storing sparse matrices is to store only the non-zero entries as opposed to storing all entries. Depending on the number and distribution of the non-zero entries, different data structure
Data structure

A data structure in computer science is a way of storing data in a computer so that it can be used efficiently. It is an organization of mathematical and logical concepts of data....
s can be used and yield huge savings in memory
Computer storage

Computer data storage, often called storage or memory, refers to computer components, devices, and recording medium that retain digital data used for computing for some interval of time....
 when compared to a naïve approach.

One example of such a sparse matrix format is the Yale Sparse Matrix Format. It stores an initial sparse m×n matrix, M, in row form using three one-dimensional arrays. Let NNZ denote the number of nonzero entries of M. The first array is A, which is of length NNZ, and holds all nonzero entries of M in left-to-right top-to-bottom order. The second array is IA, which is of length (i.e., one entry per row, plus one). IA(i) contains the index in A of the first nonzero element of row i. Row i of the original matrix extends from A(IA(i)) to A(IA(i+1)-1). The third array, JA, contains the column index of each element of A, so it also is of length NNZ.

For example, the matrix

[ 1 2 0 0 ] [ 0 3 9 0 ] [ 0 1 4 0 ]

is a three-by-four matrix with six nonzero elements, so A = [ 1 2 3 9 1 4 ] IA = [ 1 3 5 7 ] JA = [ 1 2 2 3 2 3 ]

Example


A bitmap
Bitmap

In computer graphics, a bitmap or pixmap is a type of computer storage organization or used to store digital images. The term bitmap comes from the computer programming terminology, meaning just a map of bits, a spatially mapped bit array....
 image having only 2 colors, with one of them dominant (say a file that stores a handwritten signature
Signature

A signature is a handwritten depiction of someone's name, nickname or even a simple "X" that a person writes on documents as a legal proof of Identity and intent....
) can be encoded as a sparse matrix that contains only row and column numbers for pixels with the non-dominant color.

Diagonal matrices

A very efficient structure for a diagonal matrix
Diagonal matrix

In linear algebra, a diagonal matrix is a square matrix in which the entries outside the main diagonal are all zero. The diagonal entries themselves may or may not be zero....
 is to store just the entries in the main diagonal as a one-dimensional array, so a diagonal n×n matrix requires only n entries.

Bandwidth


The lower bandwidth of a matrix A is the smallest number p such that the entry aij vanishes whenever i > j + p. Similarly, the upper bandwidth is the smallest p such that aij = 0 whenever i < jp . For example, a tridiagonal matrix
Tridiagonal matrix

In linear algebra, a tridiagonal matrix is a matrix that is "almost" a diagonal matrix. To be exact: a tridiagonal matrix has nonzero elements only in the main diagonal, the first diagonal below this, and the first diagonal above the main diagonal....
 has lower bandwidth 1 and upper bandwidth 1.

Matrices with small upper and lower bandwidth are known as band matrices
Band matrix

In mathematics, particularly matrix theory, a band matrix is a sparse matrix, whose non-zero entries are confined to a diagonal band, comprising the main diagonal and zero or more diagonals on either side....
 and often lend themselves to simpler algorithms than general sparse matrices; one can sometimes apply dense matrix algorithms and simply loop over a reduced number of indices.

Reducing bandwidth


The Cuthill-McKee algorithm
Cuthill-McKee algorithm

In the mathematics subfield of matrix theory the Cuthill?McKee algorithm is an algorithm to reduce the bandwidth of sparse matrix symmetric matrix....
 can be used to reduce the bandwidth of a sparse symmetric matrix
Symmetric matrix

In linear algebra, a symmetric matrix is a square matrix, A, that is equal to its transposeThe entries of a symmetric matrix are symmetric with respect to the main diagonal ....
. There are, however, matrices for which the Reverse Cuthill-McKee algorithm performs better.

The U.S. National Geodetic Survey
U.S. National Geodetic Survey

The National Geodetic Survey and the Office of Coast Survey are the two successor agencies in the United States to the U.S. Coast and Geodetic Survey....
 (NGS) uses Dr. Richard Snay's "Banker's" algorithm because on realistic sparse matrices used in Geodesy work it has better performance.

There are many other methods in use.

Reducing fill-in


"Fill-in" redirects here. For the puzzle, see Fill-In (puzzle)
Fill-In (puzzle)

Fill-Ins are a type of logic puzzle commonly printed in various puzzle magazines. While they superficially resemble crossword puzzles, they do not require any form of "outside knowledge"; unlike a crossword, one can solve a Fill-In in a non-native Language, even one with an alternate character set....
.


The fill-in of a matrix are those entries which change from an initial zero to a non-zero value during the execution of an algorithm. To reduce the memory requirements and the number of arithmetic operations used during an algorithm it is useful to minimize the fill-in by switching rows and columns in the matrix. The symbolic Cholesky decomposition
Symbolic Cholesky decomposition

In the mathematics subfield of numerical analysis the symbolic Cholesky decomposition is an algorithm used to determine the non-zero pattern for the factors of a symmetric matrix sparse matrix when applying the Cholesky decomposition or variants....
 can be used to calculate the worst possible fill-in before doing the actual Cholesky decomposition
Cholesky decomposition

In linear algebra, a subfield of mathematics, the Cholesky decomposition is a matrix decomposition of a symmetric matrix, positive-definite matrix matrix into a lower triangular matrix and the transpose of the lower triangular matrix....
.

There are other methods than the Cholesky decomposition
Cholesky decomposition

In linear algebra, a subfield of mathematics, the Cholesky decomposition is a matrix decomposition of a symmetric matrix, positive-definite matrix matrix into a lower triangular matrix and the transpose of the lower triangular matrix....
 in use. Orthogonalization methods (such as QR factorization) are common, for example, when solving problems by least squares methods. While the theoretical fill-in is still the same, in practical terms the "false non-zeros" can be different for different methods. And symbolic versions of those algorithms can be used in the same manner as the symbolic Cholesky to compute worst case fill-in.

Solving sparse matrix equations


Both iterative
Iterative method

In computational mathematics, an iterative method attempts to solve a problem by finding successive approximations to the solution starting from an initial guess....
 and direct methods exist for sparse matrix solving. One popular iterative method is the conjugate gradient method.

See also

  • Matrix representation
    Matrix representation

    A matrix representation is a method used by a computer language to store matrix of more than one dimension in computer storage.Fortran and C use different schemes....
  • Pareto principle
    Pareto principle

    The Pareto principle states that, for many events, roughly 80% of the effects come from 20% of the causes.Business management thinker Dr. Joseph Moses Juran suggested the principle and named it after Italian economist Vilfredo Pareto, who observed that 80% of the land in Italy was owned by 20% of the population....
  • Ragged matrix
  • Skyline matrix
    Skyline matrix

    A skyline matrix, or a variable band matrix, is a form of a sparse matrix storage format for a Square_matrix, Band_matrix matrix that reduces the storage requirement of a matrix more than banded storage....
  • Sparse array
    Sparse array

    In computer science, a sparse array is an array in which most of the elements have the same value .A naive implementation of an array may allocate space for the entire array, but in the case where there are few non-default values, this implementation is inefficient....
  • Sparse graph code
    Sparse graph code

    A Sparse graph code is a code which is represented by a sparse graph.Any linear code can be represented as a graph, where there are two sets of nodes - a set representing the transmitted bits and another set representing the constraints that the transmitted bits have to satisfy....
  • Sparse file
    Sparse file

    In computer science, a sparse file is a type of computer file that attempts to use file system space more efficiently when blocks allocated to the file are mostly empty....


Further reading


  • at the University of Florida, containing the UF sparse matrix collection.