/** * Shrink the active set: if the last x objects are all merged, we can reduce * the working size accordingly. * * @param ix Object iterator * @param builder Builder to detect merged status * @param end Current active set size * @param x Last merged object * @return New active set size */ protected static int shrinkActiveSet(DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder, int end, int x) { if(x == end - 1) { // Can truncate active set. while(builder.isLinked(ix.seek(--end - 1))) { // Everything happens in while condition already. } } return end; }
/** * Shrink the active set: if the last x objects are all merged, we can reduce * the working size accordingly. * * @param ix Object iterator * @param builder Builder to detect merged status * @param end Current active set size * @param x Last merged object * @return New active set size */ protected static int shrinkActiveSet(DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder, int end, int x) { if(x == end - 1) { // Can truncate active set. while(builder.isLinked(ix.seek(--end - 1))) { // Everything happens in while condition already. } } return end; }
/** * Find an unlinked object. * * @param pos Starting position * @param end End position * @param ix Iterator to translate into DBIDs * @param builder Linkage information * @return Position */ public static int findUnlinked(int pos, int end, DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder) { while(pos < end) { if(!builder.isLinked(ix.seek(pos))) { return pos; } ++pos; } return -1; }
/** * Find an unlinked object. * * @param pos Starting position * @param end End position * @param ix Iterator to translate into DBIDs * @param builder Linkage information * @return Position */ public static int findUnlinked(int pos, int end, DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder) { while(pos < end) { if(!builder.isLinked(ix.seek(pos))) { return pos; } ++pos; } return -1; }
if(x == wsize - 1) { --wsize; for(ix.seek(wsize - 1); builder.isLinked(ix); ix.retract()) { --wsize;
if(x == wsize - 1) { --wsize; for(ix.seek(wsize - 1); builder.isLinked(ix); ix.retract()) { --wsize;
final int ta = MatrixParadigm.triangleSize(a); for(int i = 0; i < a; i++) { if(i != b && !builder.isLinked(ix.seek(i))) { double dist = distances[ta + i]; if(dist < minDist) { if(i != b && !builder.isLinked(ix.seek(i))) { double dist = distances[MatrixParadigm.triangleSize(i) + a]; if(dist < minDist) {