IMSL C# Numerical Library

SparseMatrix.SparseArray Class

The SparseArray class uses public fields to hold the data for a sparse matrix in the Sparse Array format.

For a list of all members of this type, see SparseMatrix.SparseArray Members.

System.Object
   Imsl.Math.SparseMatrix.SparseArray

public class SparseMatrix.SparseArray

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

This format came about as a means for storing sparse matrices. In this format, a sparse matrix is represented by two arrays of arrays. One array contains the references to the nonzero value arrays for each row of the sparse matrix. The other contains the references to the associated column index arrays.

As an example, consider the following real sparse matrix:

A=\begin{pmatrix} 10.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\
            0.0 & 10.0 & -3.0 & -1.0 & 0.0 & 0.0 \\
            0.0 & 0.0 &  15.0 &	0.0 & 0.0 & 0.0 \\
            -2.0 & 0.0 & 0.0 & 10.0 & -1.0 &  0.0 \\
            -1.0 & 0.0 & 0.0 & -5.0 &  1.0 & -3.0 \\
            -1.0 & -2.0 & 0.0 & 0.0 &  0.0 & 6.0 \end{pmatrix}
In SparseArray, this matrix can be represented by the two jagged arrays, values and index, where values refers to the nonzero entries in A and index to the column indices:
         double values[][] = {{10.0},
                              {10.0, -3.0, -1.0},
                              {15.0},
                              {-2.0, 10.0, -1.0}, 
                              {-1.0, -5.0, 1.0, -3.0},
                              {-1.0, -2.0, 6.0}
                             };

         int index[][] = {{0}, 
                          {1, 2, 3},
                          {2},
                          {0, 3, 4},
                          {0, 3, 4, 5},
                          {0, 1, 5}
                         };

Requirements

Namespace: Imsl.Math

Assembly: ImslCS (in ImslCS.dll)

See Also

SparseMatrix.SparseArray Members | Imsl.Math Namespace