protected static void updateEntry ( MatrixParadigm mat , DBIDArrayMIter prots , Int2ObjectOpenHashMap < ModifiableDBIDs > clusters , DistanceQuery < ? > dq , int x , int y ) { assert ( y < x ) ; final DBIDArrayIter ix = mat . ix , iy = mat . iy ; final double [ ] distances = mat . matrix ; ModifiableDBIDs cx = clusters . get ( x ) , cy = clusters . get ( y ) ; DBIDVar prototype = DBIDUtil . newVar ( ix . seek ( x ) ) ; // Default prototype double minMaxDist ; // Two "real" clusters: if ( cx != null && cy != null ) { minMaxDist = findPrototype ( dq , cx , cy , prototype , Double . POSITIVE_INFINITY ) ; minMaxDist = findPrototype ( dq , cy , cx , prototype , minMaxDist ) ; } else if ( cx != null ) { // cy is singleton. minMaxDist = findPrototypeSingleton ( dq , cx , iy . seek ( y ) , prototype ) ; } else if ( cy != null ) { // cx is singleton. minMaxDist = findPrototypeSingleton ( dq , cy , ix . seek ( x ) , prototype ) ; } else { minMaxDist = dq . distance ( ix . seek ( x ) , iy . seek ( y ) ) ; prototype . set ( ix ) ; } final int offset = MatrixParadigm . triangleSize ( x ) + y ; distances [ offset ] = minMaxDist ; prots . seek ( offset ) . setDBID ( prototype ) ; }
Update entry at x y for distance matrix distances