int ci = cur_inds[i]; if (!seen[ci]) { LongNearestNeighbours.distanceFunc(qu, new long[][] {pnts[ci]}, dsq);
int ci = cur_inds[i]; if (!seen[ci]) { LongNearestNeighbours.distanceFunc(qu, new long[][] {pnts[ci]}, dsq);
/** * Static method to find a distance between * a query vector and a point. * * @param distance the distance measure * @param qu The query vector. * @param pnt The point to compare against. * @return The resultant distance. */ public static double distanceFunc(final LongFVComparator distance, final long [] qu, final long [] pnt) { if (distance == null) { return distanceFunc(qu, pnt); } if (distance.isDistance()) { return (double) distance.compare(qu, pnt); } else { return - (double) distance.compare(qu, pnt); } }
/** * Static method to find a distance between * a query vector and a point. * * @param distance the distance measure * @param qu The query vector. * @param pnt The point to compare against. * @return The resultant distance. */ public static double distanceFunc(final LongFVComparator distance, final long [] qu, final long [] pnt) { if (distance == null) { return distanceFunc(qu, pnt); } if (distance.isDistance()) { return (double) distance.compare(qu, pnt); } else { return - (double) distance.compare(qu, pnt); } }
/** * Static method to find a distance between * a query vector and each of a set of points. Results are stored * in the dsq_out array, much must have the same length as the number * of points. * @param distance the distance measure * @param qu The query vector. * @param pnts The points to compare against. * @param dsq_out The resultant distances. */ public static void distanceFunc(final LongFVComparator distance, final long [] qu, final long [][] pnts, double [] dsq_out) { if (distance == null) { distanceFunc(qu, pnts, dsq_out); return; } final int N = pnts.length; if (distance.isDistance()) { for (int n=0; n < N; ++n) { dsq_out[n] = (double) distance.compare(qu, pnts[n]); } } else { for (int n=0; n < N; ++n) { dsq_out[n] = - (double) distance.compare(qu, pnts[n]); } } }
/** * Static method to find a distance between * a query vector and each of a set of points. Results are stored * in the dsq_out array, much must have the same length as the number * of points. * @param distance the distance measure * @param qu The query vector. * @param pnts The points to compare against. * @param dsq_out The resultant distances. */ public static void distanceFunc(final LongFVComparator distance, final long [] qu, final long [][] pnts, double [] dsq_out) { if (distance == null) { distanceFunc(qu, pnts, dsq_out); return; } final int N = pnts.length; if (distance.isDistance()) { for (int n=0; n < N; ++n) { dsq_out[n] = (double) distance.compare(qu, pnts[n]); } } else { for (int n=0; n < N; ++n) { dsq_out[n] = - (double) distance.compare(qu, pnts[n]); } } }