public class LPNormDistanceFunction extends AbstractVectorDoubleDistanceNorm implements SpatialPrimitiveDoubleDistanceFunction<NumberVector<?>>
Modifier and Type | Class and Description |
---|---|
static class |
LPNormDistanceFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
private double |
p
Keeps the currently set p.
|
static OptionID |
P_ID
OptionID for the "p" parameter
|
Constructor and Description |
---|
LPNormDistanceFunction(double p)
Constructor, internal version.
|
Modifier and Type | Method and Description |
---|---|
double |
doubleDistance(NumberVector<?> v1,
NumberVector<?> v2)
Returns the distance between the specified FeatureVectors as a LP-Norm for
the currently set p.
|
double |
doubleMinDist(SpatialComparable mbr1,
SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this
distance function.
|
double |
doubleNorm(NumberVector<?> v)
Compute the norm of object obj as double value.
|
boolean |
equals(Object obj) |
double |
getP()
Get the functions p parameter.
|
<T extends NumberVector<?>> |
instantiate(Relation<T> relation)
Instantiate with a database to get the actual distance query.
|
boolean |
isMetric()
Is this distance function metric (in particular, does it satisfy the
triangle equation?)
|
DoubleDistance |
minDist(SpatialComparable mbr1,
SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance
function.
|
String |
toString() |
norm
distance, getDistanceFactory, getInputTypeRestriction
isSymmetric
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
distance, getInputTypeRestriction
getDistanceFactory, isSymmetric
public static final OptionID P_ID
private double p
public LPNormDistanceFunction(double p)
p
- Parameter ppublic double doubleDistance(NumberVector<?> v1, NumberVector<?> v2)
doubleDistance
in interface PrimitiveDoubleDistanceFunction<NumberVector<?>>
v1
- first FeatureVectorv2
- second FeatureVectorpublic double doubleNorm(NumberVector<?> v)
DoubleNorm
doubleNorm
in interface DoubleNorm<NumberVector<?>>
v
- Objectpublic double getP()
public double doubleMinDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDoubleDistanceFunction
doubleMinDist
in interface SpatialPrimitiveDoubleDistanceFunction<NumberVector<?>>
mbr1
- the first MBR objectmbr2
- the second MBR objectpublic DoubleDistance minDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDistanceFunction
minDist
in interface SpatialPrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
mbr1
- the first MBR objectmbr2
- the second MBR objectpublic boolean isMetric()
DistanceFunction
isMetric
in interface DistanceFunction<NumberVector<?>,DoubleDistance>
isMetric
in class AbstractPrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
true
when metric.public <T extends NumberVector<?>> SpatialPrimitiveDistanceQuery<T,DoubleDistance> instantiate(Relation<T> relation)
AbstractPrimitiveDistanceFunction
instantiate
in interface DistanceFunction<NumberVector<?>,DoubleDistance>
instantiate
in interface SpatialPrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
instantiate
in class AbstractPrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
relation
- Representation