Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-08-22 09:19:59

On Tuesday 22 August 2006 00:30, Andy Schlaikjer wrote:
> Hi uBLAS list,
> I'm working on a few functions to support boost::serialization of
> boost::numeric::ublas::mapped_matrix (including separate template
> specializations for row-major and column-major matrices) and was
> wondering if there were a way for me to access the number of non-zero
> entries in a given row/column of a sparse matrix. Right now I'm
> performing an initial iteration over non-zero entries of a row/col to
> find this number, but was wondering if direct access to this value were
> possible.

sparse types have the nnz() (number of structural nonzeros) and nnz_capacity()
member functions. nnz() is what you need.