diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/distance/distancevalue')
12 files changed, 14 insertions, 175 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/AbstractDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/AbstractDistance.java index 3e5e86af..c0573ae5 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/AbstractDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/AbstractDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/BitDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/BitDistance.java index 9c81188f..026e90aa 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/BitDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/BitDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -84,16 +84,6 @@ public class BitDistance extends NumberDistance<BitDistance, Bit> { return new BitDistance(val > 0); } - @Override - public BitDistance plus(BitDistance distance) { - return new BitDistance(this.bitValue() || distance.bitValue()); - } - - @Override - public BitDistance minus(BitDistance distance) { - return new BitDistance(this.bitValue() ^ distance.bitValue()); - } - /** * Returns the value of this BitDistance as a boolean. * diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/CorrelationDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/CorrelationDistance.java index 080f13c9..fc288809 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/CorrelationDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/CorrelationDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/Distance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/Distance.java index 73e11fa6..40dff25d 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/Distance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/Distance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -41,23 +41,6 @@ import java.io.Externalizable; */ public interface Distance<D extends Distance<D>> extends Comparable<D>, Externalizable { /** - * Returns a new distance as sum of this distance and the given distance. - * - * @param distance the distance to be added to this distance - * @return a new distance as sum of this distance and the given distance - */ - D plus(D distance); - - /** - * Returns a new Distance by subtracting the given distance from this - * distance. - * - * @param distance the distance to be subtracted from this distance - * @return a new Distance by subtracting the given distance from this distance - */ - D minus(D distance); - - /** * Any implementing class should implement a proper toString-method for * printing the result-values. * diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/DoubleDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/DoubleDistance.java index acf72c8d..4126374d 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/DoubleDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/DoubleDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -88,40 +88,6 @@ public class DoubleDistance extends NumberDistance<DoubleDistance, Double> { return new DoubleDistance(val); } - @Override - public DoubleDistance plus(DoubleDistance distance) { - return new DoubleDistance(this.value + distance.value); - } - - @Override - public DoubleDistance minus(DoubleDistance distance) { - return new DoubleDistance(this.value - distance.value); - } - - /** - * Returns a new distance as the product of this distance and the given - * distance. - * - * @param distance the distance to be multiplied with this distance - * @return a new distance as the product of this distance and the given - * distance - */ - public DoubleDistance times(DoubleDistance distance) { - return new DoubleDistance(this.value * distance.value); - } - - /** - * Returns a new distance as the product of this distance and the given double - * value. - * - * @param lambda the double value this distance should be multiplied with - * @return a new distance as the product of this distance and the given double - * value - */ - public DoubleDistance times(double lambda) { - return new DoubleDistance(this.value * lambda); - } - /** * Writes the double value of this DoubleDistance to the specified stream. */ @@ -226,7 +192,7 @@ public class DoubleDistance extends NumberDistance<DoubleDistance, Double> { @Override public String toString() { - return FormatUtil.NF8.format(value); + return FormatUtil.NF.format(value); } @Override diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/FloatDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/FloatDistance.java index 2e88b147..f72d5c1b 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/FloatDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/FloatDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -88,40 +88,6 @@ public class FloatDistance extends NumberDistance<FloatDistance, Float> { return new FloatDistance((float) val); } - @Override - public FloatDistance plus(FloatDistance distance) { - return new FloatDistance(value + distance.value); - } - - @Override - public FloatDistance minus(FloatDistance distance) { - return new FloatDistance(value - distance.value); - } - - /** - * Returns a new distance as the product of this distance and the given - * distance. - * - * @param distance the distance to be multiplied with this distance - * @return a new distance as the product of this distance and the given - * distance - */ - public FloatDistance times(FloatDistance distance) { - return new FloatDistance(value * distance.value); - } - - /** - * Returns a new distance as the product of this distance and the given float - * value. - * - * @param lambda the float value this distance should be multiplied with - * @return a new distance as the product of this distance and the given double - * value - */ - public FloatDistance times(float lambda) { - return new FloatDistance(value * lambda); - } - /** * Writes the float value of this FloatDistance to the specified stream. */ @@ -232,7 +198,7 @@ public class FloatDistance extends NumberDistance<FloatDistance, Float> { @Override public String toString() { - return FormatUtil.NF8.format(value); + return FormatUtil.NF.format(value); } @Override diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/IntegerDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/IntegerDistance.java index d776b3ae..0e206f88 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/IntegerDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/IntegerDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -73,16 +73,6 @@ public class IntegerDistance extends NumberDistance<IntegerDistance, Integer> { return new IntegerDistance((int) val); } - @Override - public IntegerDistance minus(IntegerDistance distance) { - return new IntegerDistance(this.value - distance.value); - } - - @Override - public IntegerDistance plus(IntegerDistance distance) { - return new IntegerDistance(this.value + distance.value); - } - /** * Writes the integer value of this IntegerDistance to the specified stream. */ diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/NumberDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/NumberDistance.java index 9a915c2b..92d2f4ec 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/NumberDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/NumberDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PCACorrelationDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PCACorrelationDistance.java index 79f27055..69087d59 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PCACorrelationDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PCACorrelationDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -126,16 +126,6 @@ public class PCACorrelationDistance extends CorrelationDistance<PCACorrelationDi } @Override - public PCACorrelationDistance plus(PCACorrelationDistance distance) { - return new PCACorrelationDistance(this.correlationValue + distance.getCorrelationValue(), this.euclideanValue + distance.getEuclideanValue()); - } - - @Override - public PCACorrelationDistance minus(PCACorrelationDistance distance) { - return new PCACorrelationDistance(this.correlationValue - distance.getCorrelationValue(), this.euclideanValue - distance.getEuclideanValue()); - } - - @Override public boolean isInfiniteDistance() { return correlationValue == Integer.MAX_VALUE || euclideanValue == Double.POSITIVE_INFINITY; } diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PreferenceVectorBasedCorrelationDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PreferenceVectorBasedCorrelationDistance.java index a5617372..0c82e6b5 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PreferenceVectorBasedCorrelationDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/PreferenceVectorBasedCorrelationDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -105,42 +105,6 @@ public class PreferenceVectorBasedCorrelationDistance extends CorrelationDistanc } /** - * @throws IllegalArgumentException if the dimensionality values and common - * preference vectors of this distance and the specified distance are - * not equal - */ - @Override - public PreferenceVectorBasedCorrelationDistance plus(PreferenceVectorBasedCorrelationDistance distance) { - if(this.dimensionality != distance.dimensionality) { - throw new IllegalArgumentException("The dimensionality values of this distance " + "and the specified distance need to be equal.\n" + "this.dimensionality " + this.dimensionality + "\n" + "distance.dimensionality " + distance.dimensionality + "\n"); - } - - if(!this.commonPreferenceVector.equals(distance.commonPreferenceVector)) { - throw new IllegalArgumentException("The common preference vectors of this distance " + "and the specified distance need to be equal.\n" + "this.commonPreferenceVector " + this.commonPreferenceVector + "\n" + "distance.commonPreferenceVector " + distance.commonPreferenceVector + "\n"); - } - - return new PreferenceVectorBasedCorrelationDistance(dimensionality, getCorrelationValue() + distance.getCorrelationValue(), getEuclideanValue() + distance.getEuclideanValue(), (BitSet) commonPreferenceVector.clone()); - } - - /** - * @throws IllegalArgumentException if the dimensionality values and common - * preference vectors of this distance and the specified distance are - * not equal - */ - @Override - public PreferenceVectorBasedCorrelationDistance minus(PreferenceVectorBasedCorrelationDistance distance) { - if(this.dimensionality != distance.dimensionality) { - throw new IllegalArgumentException("The dimensionality values of this distance " + "and the specified distance need to be equal.\n" + "this.dimensionality " + this.dimensionality + "\n" + "distance.dimensionality " + distance.dimensionality + "\n"); - } - - if(!this.commonPreferenceVector.equals(distance.commonPreferenceVector)) { - throw new IllegalArgumentException("The common preference vectors of this distance " + "and the specified distance need to be equal.\n" + "this.commonPreferenceVector " + this.commonPreferenceVector + "\n" + "distance.commonPreferenceVector " + distance.commonPreferenceVector + "\n"); - } - - return new PreferenceVectorBasedCorrelationDistance(dimensionality, getCorrelationValue() - distance.getCorrelationValue(), getEuclideanValue() - distance.getEuclideanValue(), (BitSet) commonPreferenceVector.clone()); - } - - /** * Checks if the dimensionality values of this distance and the specified * distance are equal. If the check fails an IllegalArgumentException is * thrown, otherwise diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/SubspaceDistance.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/SubspaceDistance.java index 094961b4..bc29b382 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/SubspaceDistance.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/SubspaceDistance.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.distance.distancevalue; 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 @@ -88,16 +88,6 @@ public class SubspaceDistance extends AbstractDistance<SubspaceDistance> { this.affineDistance = affineDistance; } - @Override - public SubspaceDistance plus(SubspaceDistance distance) { - return new SubspaceDistance(this.subspaceDistance + distance.subspaceDistance, this.affineDistance + distance.affineDistance); - } - - @Override - public SubspaceDistance minus(SubspaceDistance distance) { - return new SubspaceDistance(this.subspaceDistance - distance.subspaceDistance, this.affineDistance - distance.affineDistance); - } - /** * Returns a string representation of this SubspaceDistance. * diff --git a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/package-info.java b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/package-info.java index f302b854..ab0fdd9f 100644 --- a/src/de/lmu/ifi/dbs/elki/distance/distancevalue/package-info.java +++ b/src/de/lmu/ifi/dbs/elki/distance/distancevalue/package-info.java @@ -13,7 +13,7 @@ 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 |