@Alias(value="de.lmu.ifi.dbs.elki.distance.distancefunction.WeightedLPNormDistanceFunction") public class WeightedLPNormDistanceFunction extends LPNormDistanceFunction implements WeightedNumberVectorDistanceFunction<NumberVector>
NumberVector
.
Weighted Lp Norms are defined as: \[ L_{p,\vec{w}}(\vec{x},\vec{y}) := \left(\sum\nolimits_i w_i |x_i-y_i|^p\right)^{1/p} \]
Modifier and Type | Class and Description |
---|---|
static class |
WeightedLPNormDistanceFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
protected double[] |
weights
Weight array
|
invp, p
WEIGHTS_ID
Constructor and Description |
---|
WeightedLPNormDistanceFunction(double p,
double[] weights)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(NumberVector v1,
NumberVector v2)
Computes the distance between two given DatabaseObjects according to this
distance function.
|
boolean |
equals(java.lang.Object obj) |
SimpleTypeInformation<? super NumberVector> |
getInputTypeRestriction()
Get the input data type of the function.
|
int |
hashCode() |
double |
minDist(SpatialComparable mbr1,
SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance
function.
|
double |
norm(NumberVector v)
Compute the norm of object obj.
|
private double |
preDistance(NumberVector v1,
NumberVector v2,
int start,
int end) |
private double |
preDistanceMBR(SpatialComparable mbr1,
SpatialComparable mbr2,
int start,
int end) |
private double |
preDistanceVM(NumberVector v,
SpatialComparable mbr,
int start,
int end) |
private double |
preNorm(NumberVector v,
int start,
int end) |
private double |
preNormMBR(SpatialComparable mbr,
int start,
int end) |
getP, isMetric, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
instantiate
isMetric, isSquared, isSymmetric
instantiate
public WeightedLPNormDistanceFunction(double p, double[] weights)
p
- p valueweights
- Weight vectorprivate double preDistance(NumberVector v1, NumberVector v2, int start, int end)
private double preDistanceVM(NumberVector v, SpatialComparable mbr, int start, int end)
private double preDistanceMBR(SpatialComparable mbr1, SpatialComparable mbr2, int start, int end)
private double preNorm(NumberVector v, int start, int end)
private double preNormMBR(SpatialComparable mbr, int start, int end)
public double distance(NumberVector v1, NumberVector v2)
PrimitiveDistanceFunction
distance
in interface NumberVectorDistanceFunction<NumberVector>
distance
in interface PrimitiveDistanceFunction<NumberVector>
distance
in class LPNormDistanceFunction
v1
- first DatabaseObjectv2
- second DatabaseObjectpublic double norm(NumberVector v)
Norm
norm
in interface Norm<NumberVector>
norm
in class LPNormDistanceFunction
v
- Objectpublic double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDistanceFunction
minDist
in interface SpatialPrimitiveDistanceFunction<NumberVector>
minDist
in class LPNormDistanceFunction
mbr1
- the first MBR objectmbr2
- the second MBR objectpublic boolean equals(java.lang.Object obj)
equals
in class LPNormDistanceFunction
public int hashCode()
hashCode
in class LPNormDistanceFunction
public SimpleTypeInformation<? super NumberVector> getInputTypeRestriction()
DistanceFunction
getInputTypeRestriction
in interface DistanceFunction<NumberVector>
getInputTypeRestriction
in interface PrimitiveDistanceFunction<NumberVector>
getInputTypeRestriction
in class LPNormDistanceFunction
Copyright © 2019 ELKI Development Team. License information.