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 Details

    • 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 interface Iterator<Tensor.Cell>
    • next

      public Tensor.Cell next()
      Returns the next cell, which is valid until next() is called again
      Specified by:
      next in interface Iterator<Tensor.Cell>