Boost logo

Ublas :

Subject: Re: [ublas] [UBLAS] sparse vector get iterator from position
From: John Reid (j.reid_at_[hidden])
Date: 2010-11-16 05:32:21

On 15/11/10 09:53, John Reid wrote:
> Suppose I have one of the ublas sparse vectors and I know it holds a
> value at a certain index. How can I find the preceeding and succeeding
> non-zero values? In other words, given an index into a sparse vector is
> there an efficient way to return the iterator that points to that
> element? I can't see anything in the public API given in the documenation.

Ok I've done some digging in the header files and the find() member
function seems to do the job. The sparse vectors look very useful. It
does seem a shame the whole API isn't documented and also that the
semantics of some of the methods differ from those of the standard
library containers, e.g. clear() fills a sparse vector with zeros.