@Alias(value={"lp","minkowski","p","de.lmu.ifi.dbs.elki.distance.distancefunction.LPNormDistanceFunction"}) public class LPNormDistanceFunction extends AbstractSpatialDoubleDistanceNorm
Modifier and Type | Class and Description |
---|---|
static class |
LPNormDistanceFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
protected double |
invp
Keeps the currently set p and its inverse
|
protected double |
p
Keeps the currently set p and its inverse
|
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)
Computes the distance between two given Objects according to this distance
function.
|
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.
|
private double |
doublePreDistance(NumberVector<?> v1,
NumberVector<?> v2,
int start,
int end,
double agg)
Compute unscaled distance in a range of dimensions.
|
private double |
doublePreDistanceMBR(SpatialComparable mbr1,
SpatialComparable mbr2,
int start,
int end,
double agg)
Compute unscaled distance in a range of dimensions.
|
private double |
doublePreDistanceVM(NumberVector<?> v,
SpatialComparable mbr,
int start,
int end,
double agg)
Compute unscaled distance in a range of dimensions.
|
private double |
doublePreNorm(NumberVector<?> v,
int start,
int end,
double agg)
Compute unscaled norm in a range of dimensions.
|
private double |
doublePreNormMBR(SpatialComparable mbr,
int start,
int end,
double agg)
Compute unscaled norm in a range of dimensions.
|
boolean |
equals(Object obj) |
SimpleTypeInformation<? super NumberVector<?>> |
getInputTypeRestriction()
Get the input data type of the function.
|
double |
getP()
Get the functions p parameter.
|
boolean |
isMetric()
Is this distance function metric (in particular, does it satisfy the
triangle equation?)
|
String |
toString() |
instantiate, minDist
norm
dimensionality, dimensionality, dimensionality, dimensionality, distance, getDistanceFactory
isSymmetric
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
distance
getDistanceFactory, isSymmetric
public static final OptionID P_ID
protected double p
protected double invp
public LPNormDistanceFunction(double p)
p
- Parameter pprivate final double doublePreDistance(NumberVector<?> v1, NumberVector<?> v2, int start, int end, double agg)
v1
- First objectv2
- Second objectstart
- First dimensionend
- Exclusive last dimensionagg
- Current aggregate valueprivate final double doublePreDistanceVM(NumberVector<?> v, SpatialComparable mbr, int start, int end, double agg)
v
- First vectormbr
- Second MBRstart
- First dimensionend
- Exclusive last dimensionagg
- Current aggregate valueprivate final double doublePreDistanceMBR(SpatialComparable mbr1, SpatialComparable mbr2, int start, int end, double agg)
mbr1
- First MBRmbr2
- Second MBRstart
- First dimensionend
- Exclusive last dimensionagg
- Current aggregate valueprivate final double doublePreNorm(NumberVector<?> v, int start, int end, double agg)
v
- Data objectstart
- First dimensionend
- Exclusive last dimensionagg
- Current aggregate valueprivate final double doublePreNormMBR(SpatialComparable mbr, int start, int end, double agg)
mbr
- Data objectstart
- First dimensionend
- Exclusive last dimensionagg
- Current aggregate valuepublic double doubleDistance(NumberVector<?> v1, NumberVector<?> v2)
PrimitiveDoubleDistanceFunction
v1
- first Objectv2
- second Objectpublic double doubleNorm(NumberVector<?> v)
DoubleNorm
v
- Objectpublic double doubleMinDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDoubleDistanceFunction
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 double getP()
public SimpleTypeInformation<? super NumberVector<?>> getInputTypeRestriction()
DistanceFunction
getInputTypeRestriction
in interface DistanceFunction<NumberVector<?>,DoubleDistance>
getInputTypeRestriction
in interface PrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
getInputTypeRestriction
in class AbstractVectorDoubleDistanceFunction