docs: protected double[][] buildDistanceMatrix(ArrayDBIDs ids, DistanceQuery<?> dq) {
      final int size = ids.size();
      double[][] dmat = new double[size][size];
      final boolean square = !dq.getDistanceFunction().isSquared();
      FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Computing distance matrix", (size * (size - 1)) >>> 1, LOG) : null;
      Duration timer = LOG.isStatistics() ? LOG.newDuration(this.getClass().getName() + ".runtime.distancematrix").begin() : null;
      DBIDArrayIter ix = ids.iter(), iy = ids.iter();
      for(ix.seek(0); ix.valid(); ix.advance()) {
        double[] dmat_x = dmat[ix.getOffset()];
        for(iy.seek(ix.getOffset() + 1); iy.valid(); iy.advance()) {
          final double dist = dq.distance(ix, iy);
          dmat[iy.getOffset()][ix.getOffset()] = dmat_x[iy.getOffset()] = square ? (dist * dist) : dist;
        }
        if(prog != null) {
          int row = ix.getOffset() + 1;
          prog.setProcessed(row * size - ((row * (row + 1)) >>> 1), LOG);
        }
      }
      LOG.ensureCompleted(prog);
      if(timer != null) {
        LOG.statistics(timer.end());
      }
      return dmat;
    }