public static List<Double> closestPoint(Matrix points, List<Double> point) {
        double closestDistance = Double.POSITIVE_INFINITY;
        int closestIndex = -1;
        int size = points.getNumRows();
        for (int i = 0; i < size; i++) {
            List<Double> row = points.getRow(i);

            // Ignore the same point
            if (point.equals(row)) {
                continue;
            }

            double dist = squaredDistance(point, row);
            if (dist < closestDistance) {
                closestDistance = dist;
                closestIndex = i;
            }
        }
        return points.getRow(closestIndex);
    }