Click or drag to resize

CompressedSparseRowT Class

Class CompressedSparseRow stores general sparse matrix data in compressed row format.
Inheritance Hierarchy

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
public class CompressedSparseRow<T> : ISparseMatrixStorage<T>, 
	IEquatable<CompressedSparseRow<T>>, ICloneable

Type Parameters

Type of values stored in the sparse matrix.

The CompressedSparseRowT type exposes the following members.

Public methodCompressedSparseRowT No argument constructor. All values initialized to null or 0.
Public methodCompressedSparseRowT(IDictionaryIntPair, T, Int32) Constructs a compressed row storage instance from the given coordinate map format.
Public methodCompressedSparseRowT(IDictionaryIntPair, T, Int32, Int32) Constructs a compressed row storage instance from the given coordinate map format.
Public methodCompressedSparseRowT(Int32, Int32, Int32) Sizes all arrays to hold the specified number of non-zero values and rows.
Public methodCompressedSparseRowT(T, Int32, Int32, Int32) Constructs a CompressedSparseRow instance from the given data.
Public propertyCols Gets the number of columns in self.
Public propertyColumns Gets and sets the columns array.
Public propertyItem Indexer to retrieve values.
Public propertyNumberNonZero Gets the number of non-zero entries in self.
Public propertyRowIndex Gets and sets the row index array.
Public propertyRows Gets the number of rows in self.
Public propertyValues Gets and sets the array on non-zero values.
Public methodClone Returns a deep copy of self.
Public methodEquals(CompressedSparseRowT) Equality function for compressed row data.
Public methodEquals(Object) Equality function for compressed row data.
(Overrides ObjectEquals(Object))
Public methodGetHashCode Gets the hash code for this instance.
(Overrides ObjectGetHashCode)
Public methodInitializeData Initialized the compressed row data structures from the given coordinate map format.
Public operatorStatic memberEquality(CompressedSparseRowT, CompressedSparseRowT) Equality operator for compressed row data.
Public operatorStatic memberInequality(CompressedSparseRowT, CompressedSparseRowT) Not equals operator for compressed row data.
Protected fieldcolumns_ The columns array.
Public fieldStatic memberINCREMENT_SIZE Arrays will reallocated in chunks this size.
Protected fieldrowIndex_ Row indices.
Protected fieldvalues_ Array of nonzero values.
Compressed row sparse matrix storage is specified by three arrays:
values, columns, and rowIndex. The columns and rowIndex arrays are zero-based!
values - array of type T that contains the non-zero elements of a sparse matrix. The values are mapped into this array in row-major format.
columns - Element I of the integer array columns is the number of the column that contains the I-th element of the values array.
rowIndex - Element j of the integer array rowIndex gives the index of the element in the values array that is the first non-zero element in the row j.
As the rowIndex array gives the location of the first non-zero element within a row, and the non-zero elements are stored consecutively, the number of non-zero elements in the Ith row is equal to the difference of rowIndex[I] and rowIndex[I+1]. To have this relationship hold for the last row of the matrix, an additional entry is added to the end of rowIndex. Its value is equal to the number of non-zero elements. This makes the rowIndex array one larger that the number of rows in the matrix.
For example, the matrix | 1 -1 0 -3 0 | | -2 5 0 0 0 | B = | 0 0 4 6 4 | | -4 0 2 7 0 | | 0 8 0 0 -5 | is stored as values = (1, -1, -3, -2, 5, 4, 6, 4, -4, 2, 7, 8, -5) columns = ( 0, 1, 3, 0, 1, 2, 3, 4, 0, 2, 3, 1, 4 ) rowIndex = ( 0, 3, 5, 8, 11, 13 )
See Also