protected static void merge(int size, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<?> dq, int x, int y) {
    assert (y < x);
    final DBIDArrayIter ix = mat.ix.seek(x), iy = mat.iy.seek(y);
    final double[] distances = mat.matrix;
    int offset = MatrixParadigm.triangleSize(x) + y;

    if(LOG.isDebuggingFine()) {
      LOG.debugFine("Merging: " + DBIDUtil.toString(ix) + " -> " + DBIDUtil.toString(iy) + " " + distances[offset]);
    }

    ModifiableDBIDs cx = clusters.get(x), cy = clusters.get(y);

    // Keep y
    if(cy == null) {
      cy = DBIDUtil.newHashSet();
      cy.add(iy);
    }
    if(cx == null) {
      cy.add(ix);
    }
    else {
      cy.addDBIDs(cx);
      clusters.remove(x);
    }
    clusters.put(y, cy);

    // parent of x is set to y
    builder.add(ix, distances[offset], iy, prots.seek(offset));

    updateMatrices(size, mat, prots, builder, clusters, dq, y);
  }
protected static void merge ( int size , MatrixParadigm mat , DBIDArrayMIter prots , PointerHierarchyRepresentationBuilder builder , Int2ObjectOpenHashMap < ModifiableDBIDs > clusters , DistanceQuery < ? > dq , int x , int y ) { assert ( y < x ) ; final DBIDArrayIter ix = mat . ix . seek ( x ) , iy = mat . iy . seek ( y ) ; final double [ ] distances = mat . matrix ; int offset = MatrixParadigm . triangleSize ( x ) + y ; if ( LOG . isDebuggingFine ( ) ) { LOG . debugFine ( "Merging: " + DBIDUtil . toString ( ix ) + " -> " + DBIDUtil . toString ( iy ) + " " + distances [ offset ] ) ; } ModifiableDBIDs cx = clusters . get ( x ) , cy = clusters . get ( y ) ; if ( cy == null ) { cy = DBIDUtil . newHashSet ( ) ; cy . add ( iy ) ; } if ( cx == null ) { cy . add ( ix ) ; } else { cy . addDBIDs ( cx ) ; clusters . remove ( x ) ; } clusters . put ( y , cy ) ; builder . add ( ix , distances [ offset ] , iy , prots . seek ( offset ) ) ; updateMatrices ( size , mat , prots , builder , clusters , dq , y ) ; }
Merges two clusters given by x, y, their points with smallest IDs, and y to
keep

@param size number of ids in the data set
@param mat distance matrix
@param prots calculated prototypes
@param builder Result builder
@param clusters the clusters
@param dq distance query of the data set
@param x first cluster to merge
@param y second cluster to merge