commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [Math] "iterator" and "sparseIterator" in "RealVector" hierarchy
Date Mon, 15 Aug 2011 11:04:58 GMT

> I'm in favor of moving some methods to the SparseXXX interface, but
> got voted down at the time. For application developers (like me),
> that can expect in advance if the Vector/Matrix is sparse or not it
> isn't a big deal. But I can see how it may cause problems for other
> libraries that want to leverage C-M.  And actually, having problems
> seeing why it is a big deal in general.  If I'm doing an operation
> like outer product, I would still prefer that the iterator skips the
> zero entries.

I'm wondering whether, depending on the application field, one does not know
in advance that one should use sparse implementations ("OpenMapRealVector"
and "OpenMapRealMatrix"). If those objects are used consistently throughout
the application, the operations should all leverage the sparseness
optimizations, thanks to polymorphism.

Could there be specific unit tests demonstrating the necessity of having
something like "Iterator<Entry> sparseIterator()" in "RealVector"? The
drawback is obviously that in dense implementations, this method must be
implemented but is used only in those cases where the object should have
been "sparse" in the first place. Unless I'm mistaken, it looks as if it
would sufficient to have "converters" between sparse and dense


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message