indices[num] = instance.index(j);
num++;
}
}
if (num == instance.numValues()) {
inst = new SparseInstance(instance.weight(), vals, indices,
instance.numAttributes());
} else {
double []tempVals = new double[num];
int []tempInd = new int[num];
System.arraycopy(vals, 0, tempVals, 0, num);
System.arraycopy(indices, 0, tempInd, 0, num);
inst = new SparseInstance(instance.weight(), tempVals, tempInd,
instance.numAttributes());
}
} else {
double []vals = new double[getInputFormat().numAttributes()];
for (int j = 0; j < instance.numAttributes(); j++) {