Package elki.data

Interface SparseNumberVector

    • Method Detail

      • iter

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

        Note: depending on the underlying implementation, this may or may not be the dimension. Use SparseFeatureVector.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);
           final double val = v.iterDoubleValue(iter);
           // Do something.
         }
         
         
        Specified by:
        iter in interface SparseFeatureVector<java.lang.Number>
        Returns:
        Identifier for the first non-zero dimension, not necessarily the dimension!
      • setDimensionality

        void setDimensionality​(int maxdim)
        Update the vector space dimensionality.
        Parameters:
        maxdim - New dimensionality
      • iterDoubleValue

        double iterDoubleValue​(int iter)
        Get the value of the iterators' current dimension.
        Parameters:
        iter - Iterator
        Returns:
        Value at the current position
      • iterFloatValue

        default float iterFloatValue​(int iter)
        Get the value of the iterators' current dimension.
        Parameters:
        iter - Iterator
        Returns:
        Value at the current position
      • iterIntValue

        default int iterIntValue​(int iter)
        Get the value of the iterators' current dimension.
        Parameters:
        iter - Iterator
        Returns:
        Value at the current position
      • iterShortValue

        default short iterShortValue​(int iter)
        Get the value of the iterators' current dimension.
        Parameters:
        iter - Iterator
        Returns:
        Value at the current position
      • iterLongValue

        long iterLongValue​(int iter)
        Get the value of the iterators' current dimension.
        Parameters:
        iter - Iterator
        Returns:
        Value at the current position
      • iterByteValue

        default byte iterByteValue​(int iter)
        Get the value of the iterators' current dimension.
        Parameters:
        iter - Iterator
        Returns:
        Value at the current position
      • doubleValue

        @Deprecated
        double doubleValue​(int dimension)
        Deprecated.
        As the vectors are sparse, try to iterate over the sparse dimensions only, see iterDoubleValue(int).
        Description copied from interface: NumberVector
        Returns the value in the specified dimension as double.

        Note: this might seem redundant with respect to getValue(dim).doubleValue(), but usually this is much more efficient due to boxing/unboxing cost.

        Specified by:
        doubleValue in interface NumberVector
        Parameters:
        dimension - the desired dimension, where 0 ≤ dimension < this.getDimensionality()
        Returns:
        the value in the specified dimension
      • floatValue

        @Deprecated
        default float floatValue​(int dimension)
        Deprecated.
        As the vectors are sparse, try to iterate over the sparse dimensions only, see iterFloatValue(int).
        Description copied from interface: NumberVector
        Returns the value in the specified dimension as float.

        Note: this might seem redundant with respect to getValue(dim).floatValue(), but usually this is much more efficient due to boxing/unboxing cost.

        Specified by:
        floatValue in interface NumberVector
        Parameters:
        dimension - the desired dimension, where 0 ≤ dimension < this.getDimensionality()
        Returns:
        the value in the specified dimension
      • intValue

        @Deprecated
        default int intValue​(int dimension)
        Deprecated.
        As the vectors are sparse, try to iterate over the sparse dimensions only, see iterIntValue(int).
        Description copied from interface: NumberVector
        Returns the value in the specified dimension as int.

        Note: this might seem redundant with respect to getValue(dim).intValue(), but usually this is much more efficient due to boxing/unboxing cost.

        Specified by:
        intValue in interface NumberVector
        Parameters:
        dimension - the desired dimension, where 0 ≤ dimension < this.getDimensionality()
        Returns:
        the value in the specified dimension
      • longValue

        @Deprecated
        long longValue​(int dimension)
        Deprecated.
        As the vectors are sparse, try to iterate over the sparse dimensions only, see iterLongValue(int).
        Description copied from interface: NumberVector
        Returns the value in the specified dimension as long.

        Note: this might seem redundant with respect to getValue(dim).longValue(), but usually this is much more efficient due to boxing/unboxing cost.

        Specified by:
        longValue in interface NumberVector
        Parameters:
        dimension - the desired dimension, where 0 ≤ dimension < this.getDimensionality()
        Returns:
        the value in the specified dimension
      • shortValue

        @Deprecated
        default short shortValue​(int dimension)
        Deprecated.
        As the vectors are sparse, try to iterate over the sparse dimensions only, see iterShortValue(int).
        Description copied from interface: NumberVector
        Returns the value in the specified dimension as short.

        Note: this might seem redundant with respect to getValue(dim).shortValue(), but usually this is much more efficient due to boxing/unboxing cost.

        Specified by:
        shortValue in interface NumberVector
        Parameters:
        dimension - the desired dimension, where 0 ≤ dimension < this.getDimensionality()
        Returns:
        the value in the specified dimension
      • byteValue

        @Deprecated
        default byte byteValue​(int dimension)
        Deprecated.
        As the vectors are sparse, try to iterate over the sparse dimensions only, see iterByteValue(int).
        Description copied from interface: NumberVector
        Returns the value in the specified dimension as byte.

        Note: this might seem redundant with respect to getValue(dim).byteValue(), but usually this is much more efficient due to boxing/unboxing cost.

        Specified by:
        byteValue in interface NumberVector
        Parameters:
        dimension - the desired dimension, where 0 ≤ dimension < this.getDimensionality()
        Returns:
        the value in the specified dimension