Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.distance
Class SubspaceDistance<D extends SubspaceDistance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.distance.AbstractDistance<D>
          extended by de.lmu.ifi.dbs.elki.distance.SubspaceDistance<D>
All Implemented Interfaces:
Distance<D>, Loggable, Externalizable, Serializable, Comparable<D>

public class SubspaceDistance<D extends SubspaceDistance<D>>
extends AbstractDistance<D>

The SubspaceDistance is a special distance that indicates the dissimilarity between subspaces of equal dimensionality. The SubspaceDistance beween two points is a pair consisting of the distance between the two subspaces spanned by the strong eigenvectors of the two points and the affine distance between the two subspaces.

Author:
Elke Achtert
See Also:
Serialized Form

Field Summary
private  double affineDistance
          The affine distance.
static Pattern SEPARATOR
          Indicates a separator.
private  double subspaceDistance
          The subspace distance.
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
SubspaceDistance()
          Empty constructor for serialization purposes.
SubspaceDistance(double subspaceDistance, double affineDistance)
          Constructs a new SubspaceDistance object.
 
Method Summary
 int compareTo(D other)
           
 String description()
          Returns a String as description of this Distance.
 boolean equals(Object o)
          Returns true if o is of the same class as this instance and this.compareTo(o) is 0, false otherwise.
 int externalizableSize()
          Retuns the number of Bytes this distance uses if it is written to an external file.
 double getAffineDistance()
          Returns the value of the affine distance.
 double getSubspaceDistance()
          Returns the value of the subspace distance.
 int hashCode()
          Returns a hash code value for this object.
 D minus(D distance)
          Returns a new Distance by subtracting the given distance from this distance.
 D plus(D distance)
          Returns a new distance as sum of this distance and the given distance.
 void readExternal(ObjectInput in)
          The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 String toString()
          Returns a string representation of the object.
 void writeExternal(ObjectOutput out)
          The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final Pattern SEPARATOR
Indicates a separator.


subspaceDistance

private double subspaceDistance
The subspace distance.


affineDistance

private double affineDistance
The affine distance.

Constructor Detail

SubspaceDistance

public SubspaceDistance()
Empty constructor for serialization purposes.


SubspaceDistance

public SubspaceDistance(double subspaceDistance,
                        double affineDistance)
Constructs a new SubspaceDistance object.

Parameters:
subspaceDistance - the subspace distance
affineDistance - the affine distance
Method Detail

plus

public D plus(D distance)
Description copied from interface: Distance
Returns a new distance as sum of this distance and the given distance.

Parameters:
distance - the distancce to be added to this distance
Returns:
a new distance as sum of this distance and the given distance
See Also:
Distance.plus(de.lmu.ifi.dbs.elki.distance.Distance)

minus

public D minus(D distance)
Description copied from interface: Distance
Returns a new Distance by subtracting the given distance from this distance.

Parameters:
distance - the distance to be subtracted from this distance
Returns:
a new Distance by subtracting the given distance from this distance
See Also:
Distance.minus(de.lmu.ifi.dbs.elki.distance.Distance)

description

public String description()
Description copied from interface: Distance
Returns a String as description of this Distance.

Returns:
a String as description of this Distance
See Also:
Distance.description()

compareTo

public int compareTo(D other)
See Also:
Comparable.compareTo(Object)

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

externalizableSize

public int externalizableSize()
Retuns the number of Bytes this distance uses if it is written to an external file.

Returns:
16 (2 * 8 Byte for two double values)

toString

public String toString()
Returns a string representation of the object.

Specified by:
toString in interface Distance<D extends SubspaceDistance<D>>
Overrides:
toString in class Object
Returns:
a string representation of the object.

equals

public boolean equals(Object o)
Returns true if o is of the same class as this instance and this.compareTo(o) is 0, false otherwise.

Overrides:
equals in class AbstractDistance<D extends SubspaceDistance<D>>
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Returns a hash code value for this object.

Specified by:
hashCode in class AbstractDistance<D extends SubspaceDistance<D>>
Returns:
a hash code value for this object.
See Also:
Object.hashCode()

getSubspaceDistance

public double getSubspaceDistance()
Returns the value of the subspace distance.

Returns:
the value of the subspace distance

getAffineDistance

public double getAffineDistance()
Returns the value of the affine distance.

Returns:
the value of the affine distance

Release 0.1 (2008-07-10_1838)