summaryrefslogtreecommitdiff
path: root/src/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/ApproximationLine.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/ApproximationLine.java')
-rw-r--r--src/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/ApproximationLine.java24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/ApproximationLine.java b/src/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/ApproximationLine.java
index 7f2aa3fe..318c437b 100644
--- a/src/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/ApproximationLine.java
+++ b/src/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/ApproximationLine.java
@@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mkcop;
This file is part of ELKI:
Environment for Developing KDD-Applications Supported by Index-Structures
- Copyright (C) 2012
+ Copyright (C) 2013
Ludwig-Maximilians-Universität München
Lehr- und Forschungseinheit für Datenbanksysteme
ELKI Development Team
@@ -28,9 +28,6 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import de.lmu.ifi.dbs.elki.database.query.distance.DistanceQuery;
-import de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance;
-
/**
* Provides an approximation for knn-distances line consisting of incline m,
* axes intercept t and a start value for k.
@@ -111,7 +108,7 @@ public class ApproximationLine implements Externalizable {
* @return the function value of the approximation line at the specified k
*/
public double getValueAt(int k) {
- if(k < k_0) {
+ if (k < k_0) {
return Double.POSITIVE_INFINITY;
}
return m * StrictMath.log(k) + t;
@@ -120,17 +117,14 @@ public class ApproximationLine implements Externalizable {
/**
* Returns the approximated knn-distance at the specified k.
*
- * @param <O> Object type
- * @param <D> Distance type
* @param k the value for which the knn-distance should be returned
- * @param distanceFunction the distance function
* @return the approximated knn-distance at the specified k
*/
- public <O, D extends NumberDistance<D, ?>> D getApproximatedKnnDistance(int k, DistanceQuery<O, D> distanceFunction) {
- if(k < k_0) {
- return distanceFunction.nullDistance();
+ public double getApproximatedKnnDistance(int k) {
+ if (k < k_0) {
+ return 0.;
}
- return distanceFunction.getDistanceFactory().parseString("" + StrictMath.exp(getValueAt(k)));
+ return Math.exp(getValueAt(k));
}
/**
@@ -171,10 +165,10 @@ public class ApproximationLine implements Externalizable {
*/
@Override
public boolean equals(Object o) {
- if(this == o) {
+ if (this == o) {
return true;
}
- if(o == null || getClass() != o.getClass()) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
@@ -208,4 +202,4 @@ public class ApproximationLine implements Externalizable {
public String toString() {
return "m = " + m + ", t = " + t + " k_0 " + k_0;
}
-} \ No newline at end of file
+}