code: @Override
    public double distance(NumberVector v1, NumberVector v2) {
      double d = VectorUtil.dot(v1, v2);
      return (d <= 1) ? 1 - d : 0;
    }
docs: Computes the cosine distance for two given feature vectors.
  
  The cosine distance is computed from the cosine similarity by
  <code>1-(cosine similarity)</code>.
  
  @param v1 first feature vector
  @param v2 second feature vector
  @return the cosine distance for two given feature vectors v1 and v2