The SparseArray class uses public fields to hold
the data for a sparse matrix in the Sparse Array format.
Namespace:
Imsl.MathAssembly: ImslCS (in ImslCS.dll) Version: 6.5.0.0
Syntax
C# |
---|
[SerializableAttribute] public class SparseArray |
Visual Basic (Declaration) |
---|
<SerializableAttribute> _ Public Class SparseArray |
Visual C++ |
---|
[SerializableAttribute] public ref class SparseArray |
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 complex sparse matrix:
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: Complex values[][] = { {new Complex(10.0, -3.0)}, {new Complex(10.0, 0.0), new Complex(-3.0, 2.0), new Complex(-1.0,-1.0)}, {new Complex(15.0, 5.0)}, {new Complex(-2.0, 0.0), new Complex(10.0, 1.0), new Complex(-1.0, -2.0)}, {new Complex(-1.0, 0.0), new Complex(-5.0, 7.0), new Complex(1.0, -3.0), new Complex(-3.0, 0.0)}, {new Complex(-1.0, 4.0), new Complex(-2.0, 1.0), new Complex(6.0, -5.0)} }; int index[][] = { {0}, {1, 2, 3}, {2}, {0, 3, 4}, {0, 3, 4, 5}, {0, 1, 5} };