Boost logo

Ublas :

Subject: [ublas] Question regarding sparse vector's nnz() method
From: Rui Maciel (rui.maciel_at_[hidden])
Date: 2010-03-10 17:18:32


I was looking for a way to check how many entries are mapped in any given
sparse vector and, as the documentation doesn't mention anything related to
this, I've combed through the vector_sparse.hpp source file.

While browsing the code I've stumbled on the nnz() method, which is defined in
all sparse vector classes. After testing it it appears that it does exactly
what I was searching for. Nonetheless, as it's an undocumented method, I was
left wondering if it's results are meaningful or even if it works at all.

So, can anyone help? Does the nnz() method return the number of mapped
elements? If not, is there any way to access that information?

Thanks in advance,
Rui Maciel