Package com.yahoo.tensor
Class IndexedTensor.SubspaceIterator
- java.lang.Object
-
- com.yahoo.tensor.IndexedTensor.SubspaceIterator
-
- All Implemented Interfaces:
Iterator<Tensor.Cell>
- Enclosing class:
- IndexedTensor
public final class IndexedTensor.SubspaceIterator extends Object implements Iterator<Tensor.Cell>
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TensorAddress
address()
Returns the address of the cell this currently points to (which may be an invalid position)boolean
hasNext()
Tensor.Cell
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 subspace-
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, remove
-
-
-
-
Method Detail
-
size
public long size()
Returns the total number of cells in this subspace
-
address
public TensorAddress 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
public Tensor.Cell next()
Returns the next cell, which is valid until next() is called again- Specified by:
next
in interfaceIterator<Tensor.Cell>
-
-