Package elki.data

Interface SparseFeatureVector<D>

    • Method Detail

      • iter

        default int iter()
        Iterator over non-zero features only, ascending.

        Note: depending on the underlying implementation, this may or may not be the dimension. Use iterDim(int) to get the actual dimension. In fact, usually this will be the ith non-zero value, assuming an array representation.

        Think of this number as an iterator. For efficiency, it has a primitive type!

        Intended usage:

         
         for (int iter = v.iter(); v.iterValid(iter); iter = v.iterAdvance(iter)) {
           final int dim = v.iterDim(iter);
           // Do something.
         }
         
         
        Returns:
        Identifier for the first non-zero dimension, not necessarily the dimension!
      • iterDim

        int iterDim​(int iter)
        Get the dimension an iterator points to.
        Parameters:
        iter - Iterator position
        Returns:
        Dimension the iterator refers to
      • iterAdvance

        default int iterAdvance​(int iter)
        Advance the iterator to the next position.
        Parameters:
        iter - Previous iterator position
        Returns:
        Next iterator position
      • iterRetract

        default int iterRetract​(int iter)
        Retract the iterator to the next position.
        Parameters:
        iter - Next iterator position
        Returns:
        Previous iterator position
      • iterValid

        boolean iterValid​(int iter)
        Test the iterator position for validity.
        Parameters:
        iter - Iterator position
        Returns:
        true when it refers to a valid position.