private void linearScanBatchKNN ( ArrayDBIDs ids , List < KNNHeap > heaps ) { final DistanceQuery < O > dq = distanceQuery ; // The distance is computed on database IDs for ( DBIDIter iter = getRelation ( ) . getDBIDs ( ) . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { int index = 0 ; for ( DBIDIter iter2 = ids . iter ( ) ; iter2 . valid ( ) ; iter2 . advance ( ) , index ++ ) { KNNHeap heap = heaps . get ( index ) ; heap . insert ( dq . distance ( iter2 , iter ) , iter ) ; } } }
Linear batch knn for arbitrary distance functions .