docs: public DoubleDataStore computeAverageDistInSet() {
      WritableDoubleDataStore davg = DataStoreUtil.makeDoubleStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT);
      WritableIntegerDataStore nDists = DataStoreUtil.makeIntegerStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
      FiniteProgress splitp = LOG.isVerbose() ? new FiniteProgress("Processing splits for density estimation", splitsets.size(), LOG) : null;
      DBIDVar v = DBIDUtil.newVar();
      for(Iterator<ArrayDBIDs> it1 = splitsets.iterator(); it1.hasNext();) {
        ArrayDBIDs pinSet = it1.next();
        final int len = pinSet.size();
        final int indoff = len >> 1;
        pinSet.assignVar(indoff, v);
        V midpoint = points.get(v);
        for(DBIDArrayIter it = pinSet.iter(); it.getOffset() < len; it.advance()) {
          if(DBIDUtil.equal(it, v)) {
            continue;
          }
          double dist = EuclideanDistanceFunction.STATIC.distance(points.get(it), midpoint);
          ++distanceComputations;
          davg.increment(v, dist);
          nDists.increment(v, 1);
          davg.increment(it, dist);
          nDists.increment(it, 1);
        }
        LOG.incrementProcessed(splitp);
      }
      LOG.ensureCompleted(splitp);
      for(DBIDIter it = points.getDBIDs().iter(); it.valid(); it.advance()) {
        // it might be that a point does not occur for a certain size of a
        // projection (likely if do few projections, in this case there is no avg
        // distance)
        int count = nDists.intValue(it);
        double val = (count == 0) ? FastOPTICS.UNDEFINED_DISTANCE : (davg.doubleValue(it) / count);
        davg.put(it, val);
      }
      nDists.destroy(); // No longer needed after normalization
      return davg;
    }