* @throws DimensionMismatchException if the dimensions do not match.
*/
public double getDistance(OpenMapRealVector v)
throws DimensionMismatchException {
checkVectorDimensions(v.getDimension());
Iterator iter = entries.iterator();
double res = 0;
while (iter.hasNext()) {
iter.advance();
int key = iter.key();
double delta;
delta = iter.value() - v.getEntry(key);
res += delta * delta;
}
iter = v.getEntries().iterator();
while (iter.hasNext()) {
iter.advance();
int key = iter.key();
if (!entries.containsKey(key)) {
final double value = iter.value();
res += value * value;
}
}
return FastMath.sqrt(res);
}