}
@Override
public double distance(Vector v1, Vector v2) {
if (v1.size() != v2.size()) {
throw new CardinalityException();
}
double lengthSquaredv1 = 0.0;
Iterator<Vector.Element> iter = v1.iterateNonZero();
while (iter.hasNext()) {
Vector.Element elt = iter.next();