Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2008-01-26 15:44:23


Am Freitag, 25. Januar 2008 10:31 schrieb Markus Weimer:
> Hi,
> I iterate over the lines of a sparse matrix and need to find out how
> many non zero elements are in the line the iterator points to at the
> moment. Is that possible?

Yes, if you use a generalized_vector_of_vector. No (or not officially)
otherwise.

If you use a compressed matrix (row major storage) then the number of
nonzeros of row i is:
index1_array()[i+1] - index1_array()[i]

mfg
Gunter