commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <>
Subject Re: RealVector iterator
Date Thu, 25 Feb 2016 01:30:26 GMT

On Tue, 23 Feb 2016 10:18:40 +0000, Ziqi Zhang wrote:
> Hi,
> I would like to iterate through the non-zero values in a RealVector
> object. I notice that the method RealVector.sparseIterator() can do
> this:
> "Create a sparse iterator over the vector, which may omit some
> entries. The ommitted entries are either exact zeroes (for dense
> implementations) or are the entries which are not stored (for real
> sparse vectors). No guarantees are made about order of iteration."
> However, the method returns an Iterator<RealVector.Entry> object,
> where "Entry" is a protected class and therefore I cannot really use
> it outside of the RealVector class.

That looks like a bug indeed.

The unit tests for "RealVector" did not detect the problem because
"RealVector.Entry" can be accessed from "RealVectorTest" (as it is
defined in the same package).

Could you file a report on the issue tracking system?


> Have I misunderstood something? Is there anyway to iterate through
> the values in the RealVector object without converting them to
> double[], because the vector is very high dimensional and very 
> sparse.
> Many thanks!

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

View raw message