protected boolean computeMeanShift(double[] pt) { final List<ObjectDoublePair<double[]>> support = kde.getSupport(pt); if (support.size() == 1) { return true; } double sum = 0; final double[] out = new double[pt.length]; for (final ObjectDoublePair<double[]> p : support) { sum += p.second; for (int j = 0; j < out.length; j++) { out[j] += p.second * p.first[j]; } } double dist = 0; for (int j = 0; j < out.length; j++) { out[j] /= sum; dist += (pt[j] - out[j]) * (pt[j] - out[j]); } System.arraycopy(out, 0, pt, 0, out.length); return dist < 1e-3 * kde.getBandwidth(); } }