* @param v The vector to compute distance to
* @return The distance from <code>this</code> and <code>v</code>
* @throws IllegalArgumentException If the dimensions don't match
*/
public double getDistance(OpenMapRealVector v) throws IllegalArgumentException {
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 Math.sqrt(res);
}