docs: protected double computeABOF(KernelMatrix kernelMatrix, DBIDRef pA, DBIDArrayIter pB, DBIDArrayIter pC, MeanVariance s) {
      s.reset(); // Reused
      double simAA = kernelMatrix.getSimilarity(pA, pA);
  
      for(pB.seek(0); pB.valid(); pB.advance()) {
        if(DBIDUtil.equal(pB, pA)) {
          continue;
        }
        double simBB = kernelMatrix.getSimilarity(pB, pB);
        double simAB = kernelMatrix.getSimilarity(pA, pB);
        double sqdAB = simAA + simBB - simAB - simAB;
        if(!(sqdAB > 0.)) {
          continue;
        }
        for(pC.seek(pB.getOffset() + 1); pC.valid(); pC.advance()) {
          if(DBIDUtil.equal(pC, pA)) {
            continue;
          }
          double simCC = kernelMatrix.getSimilarity(pC, pC);
          double simAC = kernelMatrix.getSimilarity(pA, pC);
          double sqdAC = simAA + simCC - simAC - simAC;
          if(!(sqdAC > 0.)) {
            continue;
          }
          // Exploit bilinearity of scalar product:
          // <B-A, C-A> = <B,C-A> - <A,C-A>
          // = <B,C> - <B,A> - <A,C> + <A,A>
          double simBC = kernelMatrix.getSimilarity(pB, pC);
          double numerator = simBC - simAB - simAC + simAA;
          double div = 1. / (sqdAB * sqdAC);
          s.put(numerator * div, FastMath.sqrt(div));
        }
      }
      // Sample variance probably would be better here, but the ABOD publication
      // uses the naive variance.
      return s.getNaiveVariance();
    }