Boost logo

Ublas :

Subject: [ublas] Parsing Sparse Matrix to Get JA, IA, A Vector
From: Peverall Dubois (gundalav_at_[hidden])
Date: 2009-08-06 21:49:22

Does boost has a library to parse a sparse matrix
to get the index the non-zero element value?

E.g. given this matrix:

1 2 0 0
0 3 9 0
0 1 4 0

We hope it to return
A = [ 1 2 3 9 1 4 ]
IA = [ 1 3 5 7 ]
JA = [ 1 2 2 3 2 3 ]

Let NNZ denote the number of nonzero entries of Matrix. 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 m + 1 (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.

Is there any implementation for handling such a large matrix to give
us A, IA and JA, without having have to slurp all the files into RAM?
Because the actual dimension is very large 10^6 to 10^7.