Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

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

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.AbstractDatabaseObject
      extended by de.lmu.ifi.dbs.elki.data.NumberVector<V,N>
          extended by de.lmu.ifi.dbs.elki.data.RealVector<DoubleVector,Double>
              extended by de.lmu.ifi.dbs.elki.data.DoubleVector
All Implemented Interfaces:
DatabaseObject, FeatureVector<DoubleVector,Double>, SpatialComparable, SpatialObject
Direct Known Subclasses:
ParameterizationFunction

public class DoubleVector
extends RealVector<DoubleVector,Double>

A DoubleVector is to store real values approximately as double values.

Author:
Arthur Zimek

Field Summary
private  double[] values
          Keeps the values of the real vector
 
Fields inherited from class de.lmu.ifi.dbs.elki.data.NumberVector
ATTRIBUTE_SEPARATOR
 
Constructor Summary
DoubleVector(double[] values)
          Provides a DoubleVector consisting of the given double values.
DoubleVector(Double[] values)
          Provides a DoubleVector consisting of the given double values.
DoubleVector(List<Double> values)
          Provides a feature vector consisting of double values according to the given Double values.
DoubleVector(Matrix columnMatrix)
          Expects a matrix of one column.
 
Method Summary
 Vector getColumnVector()
          Returns a Vector representing in one column and getDimensionality() rows the values of this FeatureVector 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 FeatureVector of V.
 Double getValue(int dimension)
          Returns the value of the specified attribute.
 double[] getValues()
          Get a copy of the raw double[] array.
 DoubleVector multiplicate(double k)
          Returns a new FeatureVector of V that is the result of a scalar multiplication with the given scalar.
 DoubleVector negativeVector()
          Returns the additive inverse to this FeatureVector of V.
 DoubleVector newInstance(double[] values)
          Returns a new RealVector of N for the given values.
 DoubleVector newInstance(Double[] values)
          Returns a new FeatureVector of V for the given values.
 DoubleVector newInstance(List<Double> values)
          Returns a new FeatureVector of V for the given values.
 DoubleVector nullVector()
          Provides a null vector of the same Feature Vector Space as this FeatureVector of V (that is, of the same dimensionality).
 DoubleVector plus(DoubleVector fv)
          Returns a new FeatureVector of V that is the sum of this FeatureVector of V and the given FeatureVector of V.
 DoubleVector randomInstance(Double min, Double max, Random random)
          Returns a FeatureVector of V with random values between min and max.
 DoubleVector randomInstance(DoubleVector min, DoubleVector max, Random random)
          Returns a FeatureVector of V with random values between min and max.
 DoubleVector randomInstance(Random random)
          Returns a new DoubleVector with random values between 0 and 1.
 String toString()
          Returns a String representation of the FeatureVector of V as a line that is suitable to be printed in a sequential file.
 
Methods inherited from class de.lmu.ifi.dbs.elki.data.NumberVector
equals, getMax, getMin, getRange
 
Methods inherited from class de.lmu.ifi.dbs.elki.data.AbstractDatabaseObject
getID, setID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.data.DatabaseObject
getID, setID
 
Methods inherited from interface de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialObject
getID
 

Field Detail

values

private double[] values
Keeps the values of the real vector

Constructor Detail

DoubleVector

public DoubleVector(List<Double> values)
Provides a feature vector consisting of double values according to the given Double values.

Parameters:
values - the values to be set as values of the real vector

DoubleVector

public DoubleVector(double[] values)
Provides a DoubleVector consisting of the given double values.

Parameters:
values - the values to be set as values of theDoubleVector

DoubleVector

public DoubleVector(Double[] values)
Provides a DoubleVector consisting of the given double values.

Parameters:
values - the values to be set as values of theDoubleVector

DoubleVector

public DoubleVector(Matrix columnMatrix)
Expects a matrix of one column.

Parameters:
columnMatrix - a matrix of one column
Method Detail

newInstance

public DoubleVector 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 DoubleVector with the specified values

newInstance

public DoubleVector newInstance(double[] values)
Description copied from class: RealVector
Returns a new RealVector of N for the given values.

Specified by:
newInstance in class RealVector<DoubleVector,Double>
Parameters:
values - the values of the featureVector
Returns:
a new DoubleVector with the specified values

newInstance

public DoubleVector 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

randomInstance

public DoubleVector randomInstance(Random random)
Returns a new DoubleVector with random values between 0 and 1.

Parameters:
random - a Random instance
Returns:
a FeatureVector of V with random values

randomInstance

public DoubleVector randomInstance(Double min,
                                   Double max,
                                   Random random)
Description copied from interface: FeatureVector
Returns a FeatureVector of V with random values between min and max.

Parameters:
min - minimum of random value
max - maximum of random value
random - a random instance
Returns:
a FeatureVector of V with random values between min and max

randomInstance

public DoubleVector randomInstance(DoubleVector min,
                                   DoubleVector max,
                                   Random random)
Description copied from interface: FeatureVector
Returns a FeatureVector of V with random values between min and max.

Parameters:
min - minimum of random value for each axis
max - maximum of random value for each axis
random - a random instance
Returns:
a FeatureVector of V with random values between min and max
See Also:
FeatureVector.randomInstance(de.lmu.ifi.dbs.elki.data.FeatureVector, de.lmu.ifi.dbs.elki.data.FeatureVector, java.util.Random)

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

getValue

public Double getValue(int dimension)
Returns the value of the specified attribute.

Parameters:
dimension - the selected attribute. Attributes are counted starting with 1.
Returns:
the value in the specified dimension
Throws:
IllegalArgumentException - if the specified dimension is out of range of the possible attributes

getValues

public double[] getValues()
Get a copy of the raw double[] array.

Returns:
copy of values array.

getColumnVector

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

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

getRowVector

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

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

plus

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

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

nullVector

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

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

negativeVector

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

Returns:
the additive inverse to this FeatureVector of V

multiplicate

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

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

toString

public 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<DoubleVector,Double>
Overrides:
toString in class Object
Returns:
a String representation of the FeatureVector of V

Release 0.2 (2009-07-06_1820)