class SimilaritiesFunc {

    @UserFunction("gds.alpha.similarity.euclideanDistance")
    @Description("RETURN gds.alpha.similarity.euclideanDistance(vector1, vector2) - Given two collection vectors, calculate the euclidean distance (square root of the sum of the squared differences)")
    public double euclideanDistance(@Name("vector1") List<Number> vector1, @Name("vector2") List<Number> vector2) {
        if (vector1.size() != vector2.size() || vector1.size() == 0) {
            throw new RuntimeException("Vectors must be non-empty and of the same size");
        }

        int len = Math.min(vector1.size(), vector2.size());
        double[] weights1 = new double[len];
        double[] weights2 = new double[len];

        for (int i = 0; i < len; i++) {
            weights1[i] = getDoubleValue(vector1.get(i));
            weights2[i] = getDoubleValue(vector2.get(i));
        }

        return Math.sqrt(Intersections.sumSquareDelta(weights1, weights2, len));
    }

}