~ubuntu-branches/ubuntu/vivid/elki/vivid

« back to all changes in this revision

Viewing changes to src/de/lmu/ifi/dbs/elki/datasource/filter/normalization/LengthNormalization.java

  • Committer: Package Import Robot
  • Author(s): Erich Schubert
  • Date: 2012-12-14 20:45:15 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20121214204515-4m0d0er9ivtu5w9d
Tags: 0.5.5-1
New upstream release: 0.5.5 interim release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 * 
43
43
 * @param <V> vector type
44
44
 */
45
 
public class LengthNormalization<V extends NumberVector<V, ?>> extends AbstractStreamNormalization<V> {
 
45
public class LengthNormalization<V extends NumberVector<?>> extends AbstractStreamNormalization<V> {
46
46
  /**
47
 
   * Norm to use
 
47
   * Norm to use.
48
48
   */
49
49
  DoubleNorm<? super V> norm;
50
50
 
51
51
  /**
52
 
   * Constructor
 
52
   * Constructor.
53
53
   * 
54
54
   * @param norm Norm to use
55
55
   */
61
61
  @Override
62
62
  protected V filterSingleObject(V featureVector) {
63
63
    final double d = norm.doubleNorm(featureVector);
64
 
    return featureVector.newNumberVector(featureVector.getColumnVector().timesEquals(1 / d).getArrayRef());
 
64
    return factory.newNumberVector(featureVector.getColumnVector().timesEquals(1 / d).getArrayRef());
65
65
  }
66
66
 
67
67
  @Override
68
 
  public V restore(V featureVector) throws NonNumericFeaturesException {
 
68
  public V restore(V featureVector) {
69
69
    throw new UnsupportedOperationException();
70
70
  }
71
71
 
87
87
   * 
88
88
   * @apiviz.exclude
89
89
   */
90
 
  public static class Parameterizer<V extends NumberVector<V, ?>> extends AbstractParameterizer {
 
90
  public static class Parameterizer<V extends NumberVector<?>> extends AbstractParameterizer {
91
91
    /**
92
 
     * Option ID for normalization norm
 
92
     * Option ID for normalization norm.
93
93
     */
94
 
    public static final OptionID NORM_ID = OptionID.getOrCreateOptionID("normalization.norm", "Norm (length function) to use for computing the vector length.");
 
94
    public static final OptionID NORM_ID = new OptionID("normalization.norm", "Norm (length function) to use for computing the vector length.");
95
95
 
96
96
    /**
97
 
     * Norm to use
 
97
     * Norm to use.
98
98
     */
99
99
    DoubleNorm<? super V> norm;
100
100