|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.tuwien.ifs.feature.extraction.audio.distance.AbstractMetric
public abstract class AbstractMetric
Implements a static method for metric instantiation and a method for mean vector calculation.
Furthermore, implements the convenience methods to call the abstract method having two double
arrays as arguments (see distance(double[], double[])
). This method has to be
implemented by classes actually implementing a certain metric.
Constructor Summary | |
---|---|
AbstractMetric()
|
Method Summary | |
---|---|
protected void |
checkDimensions(double[] vector1,
double[] vector2)
Performs a check on wether the given vectors have the same dimension. |
abstract double |
distance(double[] vector1,
double[] vector2)
Calculates the distance between two vectors provided by argument vector1 and
vector2 . |
static DistanceMetric |
instantiate(java.lang.String mName)
Instantiates a certain distance metric class specified by argument mName . |
static double[] |
meanVector(double[] vector1,
double[] vector2)
Calculates the mean vector of two double array vectors. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractMetric()
Method Detail |
---|
public static DistanceMetric instantiate(java.lang.String mName) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
mName
.
mName
- the name of the metric.
mName
.
java.lang.ClassNotFoundException
- if class denoted by argument mName
is not found.
java.lang.InstantiationException
- if if this Class represents an abstract class, an interface,
an array class, a primitive type, or void; or if the class has no nullary
constructor; or if the instantiation fails for some other reason.
java.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.public static double[] meanVector(double[] vector1, double[] vector2) throws MetricException
vector1
- first vector.vector2
- second vector.
MetricException
- if the dimensionalities of the two vectors differ.public abstract double distance(double[] vector1, double[] vector2) throws MetricException
DistanceMetric
vector1
and
vector2
. A MetricException
is thrown, if the dimensionalities of
the two vectors differ.
distance
in interface DistanceMetric
vector1
- first vector.vector2
- second vector.
vector1
and vector2
.
MetricException
- if the dimensionalities of the two vectors differ.DistanceMetric.distance(double[], double[])
protected void checkDimensions(double[] vector1, double[] vector2) throws MetricException
MetricException
- If the given vectors have different dimensions.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |