Package org.hipparchus.linear
Class RealVector.SparseEntryIterator
- java.lang.Object
-
- org.hipparchus.linear.RealVector.SparseEntryIterator
-
- All Implemented Interfaces:
Iterator<RealVector.Entry>
- Enclosing class:
- RealVector
protected class RealVector.SparseEntryIterator extends Object implements Iterator<RealVector.Entry>
This class should rarely be used, but is here to provide a default implementation of sparseIterator(), which is implemented by walking over the entries, skipping those that are zero. Concrete subclasses which are SparseVector implementations should make their own sparse iterator, rather than using this one. This implementation might be useful for ArrayRealVector, when expensive operations which preserve the default value are to be done on the entries, and the fraction of non-default values is small (i.e. someone took a SparseVector, and passed it into the copy-constructor of ArrayRealVector)
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SparseEntryIterator()
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
advance(RealVector.Entry e)
Advance an entry up to the next nonzero one.boolean
hasNext()
RealVector.Entry
next()
void
remove()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Method Detail
-
advance
protected void advance(RealVector.Entry e)
Advance an entry up to the next nonzero one.- Parameters:
e
- entry to advance.
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<RealVector.Entry>
-
next
public RealVector.Entry next()
- Specified by:
next
in interfaceIterator<RealVector.Entry>
-
remove
public void remove() throws MathRuntimeException
- Specified by:
remove
in interfaceIterator<RealVector.Entry>
- Throws:
MathRuntimeException
- in all circumstances.
-
-