public class PNormDistanceFunction extends java.lang.Object implements DistanceFunction
| Modifier and Type | Field and Description |
|---|---|
private boolean |
normalize
Whether the distance should be normalized to [0,1].
|
private int |
p
The parameter for the p-norm.
|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
PNormDistanceFunction(int p,
boolean normalize)
Creates a new p-norm distance function.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distance(java.util.List<java.lang.Double> l1,
java.util.List<java.lang.Double> l2)
Measures the distance between the two vectors.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
java.lang.String |
toString() |
private static final long serialVersionUID
private int p
private boolean normalize
public PNormDistanceFunction(int p,
boolean normalize)
p - the parameter for the p-norm.public double distance(java.util.List<java.lang.Double> l1,
java.util.List<java.lang.Double> l2)
DistanceFunctiondistance in interface DistanceFunctionl1 - some list of doubles.l2 - some list of doubles.public java.lang.String toString()
toString in interface DistanceFunctiontoString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object