commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ziqi Zhang <>
Subject RealVector iterator
Date Tue, 23 Feb 2016 10:18:40 GMT

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.

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!
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message