Boost logo

Ublas :

Subject: Re: [ublas] zero_matrix iteration
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2009-09-13 15:16:03


Marco Guazzone schrieb:
> Hello dears,
>
> I've noticed that zero_matrix is "not iteratable".
> That is if you iterate a zero_matrix Z either by-row or by-column the
> condition "Z.begin1() != Z.end1()" or "Z.begin1() != Z.end2()",
> respectively, is always FALSE (according to how zero_matrix iterators
> are defined).
> However if you iterate by using plain row/column indices (instead of
> iterators) you're successfully able to iterate through a zero_matrix.
>
> Is this conceptually right?
>
>
Yes, I think so. Since uBLAS is designed to do linear algebra all
iterators may skip matrix/vector elements that are zero. Because the
zero_matrix has only zero elements the condition zm.begin1() ==
zm.end1() is always satisfied. The interator range [(begin1(), end1())
is always empty.

mfg
Gunter