docs: private void initializeRadii(DBIDs ids, KNNQuery<O> knnq, DistanceQuery<O> distFunc, WritableDoubleDataStore radii) {
      FiniteProgress avgDistProgress = LOG.isVerbose() ? new FiniteProgress("Calculating average kNN distances-", ids.size(), LOG) : null;
      double absoluteMinDist = Double.POSITIVE_INFINITY;
      double minAvgDist = Double.POSITIVE_INFINITY;
      // to get the mean for each object
      Mean mean = new Mean();
      // Iterate over all objects
      for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
        KNNList iterNeighbors = knnq.getKNNForDBID(iter, k);
        // skip the point itself
        mean.reset();
        for(DBIDIter neighbor1 = iterNeighbors.iter(); neighbor1.valid(); neighbor1.advance()) {
          if(DBIDUtil.equal(neighbor1, iter)) {
            continue;
          }
          for(DBIDIter neighbor2 = iterNeighbors.iter(); neighbor2.valid(); neighbor2.advance()) {
            if(DBIDUtil.equal(neighbor1, neighbor2) || DBIDUtil.equal(neighbor2, iter)) {
              continue;
            }
            double distance = distFunc.distance(neighbor1, neighbor2);
            mean.put(distance);
            if(distance > 0. && distance < absoluteMinDist) {
              absoluteMinDist = distance;
            }
          }
        }
        double currentMean = mean.getMean();
        radii.putDouble(iter, currentMean);
        if(currentMean < minAvgDist) {
          minAvgDist = currentMean;
        }
        LOG.incrementProcessed(avgDistProgress);
      }
      LOG.ensureCompleted(avgDistProgress);
  
      // Initializing the radii of all objects.
      for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
        radii.putDouble(iter, (minAvgDist > 0) ? (absoluteMinDist * radii.doubleValue(iter) / minAvgDist) : Double.POSITIVE_INFINITY);
      }
    }