question: @ Override public double [ ] [ ] processIds ( DBIDs ids , Relation < ? extends NumberVector > relation ) { final int dim = RelationUtil . dimensionality ( relation ) ; final CovarianceMatrix cmat = new CovarianceMatrix ( dim ) ; final Centroid centroid = Centroid . make ( relation , ids ) ; double maxdist = 0.0 ; double stddev = 0.0 ; { for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { NumberVector obj = relation . get ( iter ) ; double distance = weightDistance . distance ( centroid , obj ) ; stddev += distance * distance ; if ( distance > maxdist ) { maxdist = distance ; } } if ( maxdist == 0.0 ) { maxdist = 1.0 ; } stddev = Math . sqrt ( stddev / ids . size ( ) ) ; } for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { NumberVector obj = relation . get ( iter ) ; double distance = weightDistance . distance ( centroid , obj ) ; double weight = weightfunction . getWeight ( distance , maxdist , stddev ) ; cmat . put ( obj , weight ) ; } return cmat . destroyToNaiveMatrix ( ) ; }
target:  Weighted Covariance Matrix for a set of IDs. Since we are not supplied any distance information, we'll need to compute it ourselves. Covariance is tied to Euclidean distance, so it probably does not make much sense to add support for other distance functions?