Package com.yahoo.tensor
Class IndexedTensor.SubspaceIterator
java.lang.Object
com.yahoo.tensor.IndexedTensor.SubspaceIterator
- All Implemented Interfaces:
Iterator<Tensor.Cell>
- Enclosing class:
- IndexedTensor
An iterator over a subspace of this tensor. This is exposed to allow clients to query the size.
NOTE THAT the Cell returned by next is only valid until the next() call is made.
This is a concession to performance due to this typically being used in inner loops.
-
Method Summary
Modifier and TypeMethodDescriptionaddress()
Returns the address of the cell this currently points to (which may be an invalid position)boolean
hasNext()
next()
Returns the next cell, which is valid until next() is called againvoid
reset()
Rewind this iterator to the first elementlong
size()
Returns the total number of cells in this subspaceMethods 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, remove
-
Method Details
-
size
public long size()Returns the total number of cells in this subspace -
address
Returns the address of the cell this currently points to (which may be an invalid position) -
reset
public void reset()Rewind this iterator to the first element -
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<Tensor.Cell>
-
next
Returns the next cell, which is valid until next() is called again- Specified by:
next
in interfaceIterator<Tensor.Cell>
-