de.lmu.ifi.dbs.elki.distance.distancefunction
Class AbstractCosineDistanceFunction

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
          extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractCosineDistanceFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDoubleDistanceFunction<NumberVector<?,?>>, InspectionUtilFrequentlyScanned, Parameterizable
Direct Known Subclasses:
ArcCosineDistanceFunction, CosineDistanceFunction

public abstract class AbstractCosineDistanceFunction
extends AbstractVectorDoubleDistanceFunction

Abstract base class for Cosine and ArcCosine distances.


Constructor Summary
AbstractCosineDistanceFunction()
          Constructor.
 
Method Summary
protected  double angle(NumberVector<?,?> v1, NumberVector<?,?> v2)
          Compute the angle between two vectors.
protected  double angleSparse(SparseNumberVector<?,?> v1, SparseNumberVector<?,?> v2)
          Compute the angle for sparse vectors.
<T extends NumberVector<?,?>>
PrimitiveDistanceQuery<T,DoubleDistance>
instantiate(Relation<T> relation)
          Instantiate with a database to get the actual distance query.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
distance, getDistanceFactory, getInputTypeRestriction
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction
isMetric, isSymmetric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDoubleDistanceFunction
doubleDistance
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
isMetric, isSymmetric
 

Constructor Detail

AbstractCosineDistanceFunction

public AbstractCosineDistanceFunction()
Constructor.

Method Detail

angle

protected double angle(NumberVector<?,?> v1,
                       NumberVector<?,?> v2)
Compute the angle between two vectors.

Parameters:
v1 - first vector
v2 - second vector
Returns:
Angle

angleSparse

protected double angleSparse(SparseNumberVector<?,?> v1,
                             SparseNumberVector<?,?> v2)
Compute the angle for sparse vectors.

Parameters:
v1 - First vector
v2 - Second vector
Returns:
angle

instantiate

public <T extends NumberVector<?,?>> PrimitiveDistanceQuery<T,DoubleDistance> instantiate(Relation<T> relation)
Description copied from class: AbstractPrimitiveDistanceFunction
Instantiate with a database to get the actual distance query.

Specified by:
instantiate in interface DistanceFunction<NumberVector<?,?>,DoubleDistance>
Overrides:
instantiate in class AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Parameters:
relation - Representation
Returns:
Actual distance query.

Release 0.4.0 (2011-09-20_1324)