|
Ublas : |
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-03-07 05:17:24
On Monday 07 March 2005 01:30, Dan Elliott wrote:
> I am getting an error when trying to increment the iterator1 of a
> compressed_matrix, obtained using the begin1 method, by more than one
> index. Are these not random access iterators? Is this done by design?
> If so, why and what would be the fastest method of sequentially
> accessing each element of randomly selected row?
iterator1 only stores an index. It should behave like a random access
iterator. But there are still some implementations of operator += missing.
> In case it's needed, here is some sample code:
>
> typename compressed_matrix<T,F>::iterator1 r;
> for(vector<unsigned short>::iterator i = whereToGo.begin();
> i != whereToGo.end();
> ++i){
> r = src.begin1();
> r += *i;
> for(typename compressed_matrix<T,F>::iterator2 c = r.begin();
As a workaround I suggest:
typedef typename matrix_row< compressed_matrix<T,F> > ROW;
ROW r(src, *i)
for(ROW::iterator c = r.begin();
> c != r.end();
> ++c){
> //...blah...
> }
> }
> }
mfg
Gunter