Package elki.data

Class FloatVector

    • Constructor Detail

      • FloatVector

        private FloatVector​(float[] values,
                            boolean nocopy)
        Private constructor. NOT for public use.
        Parameters:
        values - Data values
        nocopy - Flag to re-use the values array
      • FloatVector

        public FloatVector​(float[] values)
        Create a FloatVector consisting of the given float values.
        Parameters:
        values - the values to be set as values of the float vector
    • Method Detail

      • getDimensionality

        public int getDimensionality()
        Description copied from interface: FeatureVector
        The dimensionality of the vector space where of this FeatureVector of V is an element.
        Specified by:
        getDimensionality in interface FeatureVector<java.lang.Number>
        Specified by:
        getDimensionality in interface SpatialComparable
        Returns:
        the number of dimensions of this FeatureVector of V
      • getValue

        @Deprecated
        public java.lang.Float getValue​(int dimension)
        Deprecated.
        Description copied from interface: FeatureVector
        Returns the value in the specified dimension.
        Specified by:
        getValue in interface FeatureVector<java.lang.Number>
        Specified by:
        getValue in interface NumberVector
        Parameters:
        dimension - the desired dimension, where 0 ≤ dimension ≤ this.getDimensionality()-1
        Returns:
        the value in the specified dimension
      • doubleValue

        public double doubleValue​(int dimension)
        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

        public float floatValue​(int dimension)
        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
      • longValue

        public long longValue​(int dimension)
        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
      • toArray

        public double[] toArray()
        Description copied from interface: NumberVector
        Returns a double array copy of this vector.
        Specified by:
        toArray in interface NumberVector
        Returns:
        Copy as double[]
      • toString

        public java.lang.String toString()
        Description copied from interface: FeatureVector
        Returns a String representation of the FeatureVector of V as a line that is suitable to be printed in a sequential file.
        Specified by:
        toString in interface FeatureVector<java.lang.Number>
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of the FeatureVector of V