CompressedRowMatrix - Real
The CompressedRowMatrix is a sparse row-major matrix of double values.
The matrix elements are stored in four internal arrays, one holds the element's
value, one holds the element's column index and the other two identify
the elements for a row. Using two arrays to identify the elements in a
row instead of one allows the matrix to hold extra elements for a row to
accomodate fill-in. This matrix is efficient for numerical computing, especially
row-wise computations.
Here is an example of a sparse matrix with four rows and four columns:
|
Col-0 |
Col-1 |
Col-2 |
Col-3 |
Row-0 |
1.3 |
. |
4.5 |
. |
Row-1 |
. |
2.1 |
. |
. |
Row-2 |
. |
. |
. |
6.2 |
Row-3 |
7.3 |
8.5 |
. |
. |
This is how the 4x4 matrix could be stored in a CompressedRowMatrix
with a row capacity of five:
Row-Begin
Index |
0 |
1 |
2 |
3 |
4 |
Value |
0 |
2 |
4 |
6 |
. |
Row-Size
Index |
0 |
1 |
2 |
3 |
4 |
Value |
2 |
1 |
1 |
2 |
. |
Values
Index |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
Value |
1.3 |
4.5 |
2.1 |
. |
6.2 |
. |
7.3 |
8.5 |
. |
Column-Index
Index |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
Value |
0 |
2 |
1 |
. |
3 |
. |
0 |
1 |
. |
Column Index Structure
The CompressedRowMatrix can contain an index into the columns of the matrix.This
index must be explicitly built after the last element has been added to
the matrix. The index will be deleted if any elements are added after it
is built
This is how the index would be stored for the 4x4 example:
Column-End
Index |
0 |
1 |
2 |
3 |
Value |
2 |
4 |
5 |
6 |
Row-Index
Index |
0 |
1 |
2 |
3 |
4 |
5 |
Value |
0 |
3 |
1 |
3 |
0 |
2 |
Value-Index
Index |
0 |
1 |
2 |
3 |
4 |
5 |
Value |
0 |
6 |
2 |
7 |
1 |
4 |
Copyright(C)1997-99 by DRA Systems all rights reserved.