@@ -0,0 +1,1485 @@
+package de.lmu.ifi.dbs.elki.datasource.filter;%0A%0Aimport de.lmu.ifi.dbs.elki.data.SparseFloatVector;%0Aimport de.lmu.ifi.dbs.elki.data.type.SimpleTypeInformation;%0Aimport de.lmu.ifi.dbs.elki.data.type.TypeUtil;%0Aimport de.lmu.ifi.dbs.elki.data.type.VectorFieldTypeInformation;%0A%0A/**%0A * Class that turns sparse float vectors into a proper vector field, by setting%0A * the maximum dimensionality for each vector.%0A * %0A * @author Erich Schubert%0A */%0Apublic class SparseVectorFieldFilter extends AbstractConversionFilter%3CSparseFloatVector, SparseFloatVector%3E %7B%0A  /**%0A   * Maximum dimension%0A   */%0A  int maxdim = -1;%0A%0A  /**%0A   * Constructor.%0A   */%0A  public SparseVectorFieldFilter() %7B%0A    super();%0A  %7D%0A%0A  @Override%0A  protected boolean prepareStart(SimpleTypeInformation%3CSparseFloatVector%3E in) %7B%0A    return true;%0A  %7D%0A%0A  @Override%0A  protected void prepareProcessInstance(SparseFloatVector obj) %7B%0A    maxdim = Math.max(maxdim, obj.getDimensionality());%0A  %7D%0A%0A  @Override%0A  protected SparseFloatVector filterSingleObject(SparseFloatVector obj) %7B%0A    assert(maxdim %3E 0);%0A    obj.setDimensionality(maxdim);%0A    return obj;%0A  %7D%0A%0A  @Override%0A  protected SimpleTypeInformation%3C? super SparseFloatVector%3E getInputTypeRestriction() %7B%0A    return TypeUtil.SPARSE_FLOAT_FIELD;%0A  %7D%0A%0A  @Override%0A  protected SimpleTypeInformation%3C? super SparseFloatVector%3E convertedType(SimpleTypeInformation%3CSparseFloatVector%3E in) %7B%0A    return new VectorFieldTypeInformation%3CSparseFloatVector%3E(SparseFloatVector.class, maxdim);%0A  %7D%0A%7D

Add filter to turn sparse vectors into a vector field (of the same dimensionality!)