de.lmu.ifi.dbs.elki.data
Class OneDimensionalDoubleVector

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.AbstractNumberVector<OneDimensionalDoubleVector,Double>
      extended by de.lmu.ifi.dbs.elki.data.OneDimensionalDoubleVector
All Implemented Interfaces:
FeatureVector<OneDimensionalDoubleVector,Double>, NumberVector<OneDimensionalDoubleVector,Double>, SpatialComparable

public class OneDimensionalDoubleVector
extends AbstractNumberVector<OneDimensionalDoubleVector,Double>

Specialized class implementing a one-dimensional double vector without using an array. Saves a little bit of memory, albeit we cannot avoid boxing as long as we want to implement the interface.


Field Summary
(package private)  double val
          The actual data value
 
Fields inherited from class de.lmu.ifi.dbs.elki.data.AbstractNumberVector
ATTRIBUTE_SEPARATOR
 
Constructor Summary
OneDimensionalDoubleVector(double val)
          Constructor.
 
Method Summary
 double doubleValue(int dimension)
          Returns the value in the specified dimension as double.
 Vector getColumnVector()
          Returns a Vector representing in one column and getDimensionality() rows the values of this NumberVector of V.
 int getDimensionality()
          The dimensionality of the vector space where of this FeatureVector of V is an element.
 Matrix getRowVector()
          Returns a Matrix representing in one row and getDimensionality() columns the values of this NumberVector of V.
 Double getValue(int dimension)
          Returns the value in the specified dimension.
 long longValue(int dimension)
          Returns the value in the specified dimension as long.
 OneDimensionalDoubleVector minus(OneDimensionalDoubleVector fv)
          Returns a new NumberVector of V that is the sum of this NumberVector of V and the negativeVector() of given NumberVector of V.
 OneDimensionalDoubleVector multiplicate(double k)
          Returns a new NumberVector of V that is the result of a scalar multiplication with the given scalar.
 OneDimensionalDoubleVector negativeVector()
          Returns the additive inverse to this NumberVector of V.
 OneDimensionalDoubleVector newInstance(double[] values)
          Returns a new NumberVector of N for the given values.
 OneDimensionalDoubleVector newInstance(Double[] values)
          Returns a new FeatureVector of V for the given values.
 OneDimensionalDoubleVector newInstance(List<Double> values)
          Returns a new FeatureVector of V for the given values.
 OneDimensionalDoubleVector newInstance(Vector values)
          Returns a new NumberVector of N for the given values.
 OneDimensionalDoubleVector nullVector()
          Provides a null vector of the same Vector Space as this NumberVector of V (that is, of the same dimensionality).
 OneDimensionalDoubleVector plus(OneDimensionalDoubleVector fv)
          Returns a new NumberVector of V that is the sum of this NumberVector of V and the given NumberVector of V.
 Double scalarProduct(OneDimensionalDoubleVector fv)
          Provides the scalar product (inner product) of this NumberVector of V and the given NumberVector of V.
 
Methods inherited from class de.lmu.ifi.dbs.elki.data.AbstractNumberVector
byteValue, equals, floatValue, getMax, getMin, hashCode, intValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.data.FeatureVector
toString
 

Field Detail

val

double val
The actual data value

Constructor Detail

OneDimensionalDoubleVector

public OneDimensionalDoubleVector(double val)
Constructor.

Parameters:
val - Value
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.

Returns:
the number of dimensions of this FeatureVector of V

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.

Parameters:
dimension - the desired dimension, where 1 ≤ 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.

Parameters:
dimension - the desired dimension, where 1 ≤ dimension ≤ this.getDimensionality()
Returns:
the value in the specified dimension

getValue

public Double getValue(int dimension)
Description copied from interface: FeatureVector
Returns the value in the specified dimension.

Parameters:
dimension - the desired dimension, where 1 ≤ dimension ≤ this.getDimensionality()
Returns:
the value in the specified dimension

getColumnVector

public Vector getColumnVector()
Description copied from interface: NumberVector
Returns a Vector representing in one column and getDimensionality() rows the values of this NumberVector of V.

Returns:
a Matrix representing in one column and getDimensionality() rows the values of this NumberVector of V

getRowVector

public Matrix getRowVector()
Description copied from interface: NumberVector
Returns a Matrix representing in one row and getDimensionality() columns the values of this NumberVector of V.

Returns:
a Matrix representing in one row and getDimensionality() columns the values of this NumberVector of V

nullVector

public OneDimensionalDoubleVector nullVector()
Description copied from interface: NumberVector
Provides a null vector of the same Vector Space as this NumberVector of V (that is, of the same dimensionality).

Returns:
a null vector of the same Vector Space as this NumberVector of V (that is, of the same dimensionality)

negativeVector

public OneDimensionalDoubleVector negativeVector()
Description copied from interface: NumberVector
Returns the additive inverse to this NumberVector of V.

Returns:
the additive inverse to this NumberVector of V

plus

public OneDimensionalDoubleVector plus(OneDimensionalDoubleVector fv)
Description copied from interface: NumberVector
Returns a new NumberVector of V that is the sum of this NumberVector of V and the given NumberVector of V.

Parameters:
fv - a NumberVector of V to be added to this NumberVector of V
Returns:
a new NumberVector of V that is the sum of this NumberVector of V and the given NumberVector of V

minus

public OneDimensionalDoubleVector minus(OneDimensionalDoubleVector fv)
Description copied from interface: NumberVector
Returns a new NumberVector of V that is the sum of this NumberVector of V and the negativeVector() of given NumberVector of V.

Parameters:
fv - a NumberVector of V to be subtracted to this NumberVector of V
Returns:
a new NumberVector of V that is the sum of this NumberVector of V and the negative of given NumberVector of V

scalarProduct

public Double scalarProduct(OneDimensionalDoubleVector fv)
Description copied from interface: NumberVector
Provides the scalar product (inner product) of this NumberVector of V and the given NumberVector of V.

Parameters:
fv - the NumberVector of V to compute the scalar product for
Returns:
the scalar product (inner product) of this and the given NumberVector of V

multiplicate

public OneDimensionalDoubleVector multiplicate(double k)
Description copied from interface: NumberVector
Returns a new NumberVector of V that is the result of a scalar multiplication with the given scalar.

Parameters:
k - a scalar to multiply this NumberVector of V with
Returns:
a new NumberVector of V that is the result of a scalar multiplication with the given scalar

newInstance

public OneDimensionalDoubleVector newInstance(double[] values)
Description copied from interface: NumberVector
Returns a new NumberVector of N for the given values.

Parameters:
values - the values of the NumberVector
Returns:
a new NumberVector of N for the given values

newInstance

public OneDimensionalDoubleVector newInstance(Vector values)
Description copied from interface: NumberVector
Returns a new NumberVector of N for the given values.

Parameters:
values - the values of the NumberVector
Returns:
a new NumberVector of N for the given values

newInstance

public OneDimensionalDoubleVector newInstance(Double[] values)
Description copied from interface: FeatureVector
Returns a new FeatureVector of V for the given values.

Parameters:
values - the values of the featureVector
Returns:
a new FeatureVector of V for the given values

newInstance

public OneDimensionalDoubleVector newInstance(List<Double> values)
Description copied from interface: FeatureVector
Returns a new FeatureVector of V for the given values.

Parameters:
values - the values of the featureVector
Returns:
a new FeatureVector of V for the given values

Release 0.4.0 (2011-09-20_1324)