code: @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);
  
      // find maximum distance
      double maxdist = 0.0, stddev = 0.0;
      {
        for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
          double distance = weightDistance.distance(centroid, relation.get(iter));
          stddev += distance * distance;
          if(distance > maxdist) {
            maxdist = distance;
          }
        }
        if(maxdist == 0.0) {
          maxdist = 1.0;
        }
        // compute standard deviation.
        stddev = FastMath.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.destroyToPopulationMatrix();
    }
docs: 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?
  
  @param ids Database ids to process
  @param relation Relation to process
  @return Covariance matrix