Seems like we should use the Iterator in most places and focus on
making it fast. It is likely that we could make some optimizations to
the Iterator to take better advantage of the underlying structures,
instead of relying on the Abstract version.
On Jun 23, 2009, at 5:10 PM, Sean Owen wrote:
You bet, Vector implements Iterable<Vector.Element>!
In the case of SparseVector it only hits the nonzero elements.
I wonder if we can tighten up the contract of Vector in this respect:
- can it really not guarantee in-order iteration? this seems intuitive
and maybe useful
- should state it may not (will not?) hit elements that are zero?
On Tue, Jun 23, 2009 at 5:00 PM, Ted Dunning<ted.dunn...@gmail.com>
wrote:
Do we have a good way to iterate over non-zero elements?
On Tue, Jun 23, 2009 at 12:36 PM, Grant Ingersoll <gsing...@apache.org
>wrote:
I'm doing some more profiling and it seems like all over the place
we are
looping from i = 0; i < size() and calling getQuick. This is
then, for
SparseVector, dominated by the find lookup, which is taking up a
lot of
time.
So, it's not that find() is slow, but the fact that we are
needlessly
calling getQuick() for loops.
Just an FYI as we go forward not to do that.