docs: private static void initializeNNCache(double[] scratch, double[] bestd, int[] besti) {
      final int size = bestd.length;
      Arrays.fill(bestd, Double.POSITIVE_INFINITY);
      Arrays.fill(besti, -1);
      for(int x = 0, p = 0; x < size; x++) {
        assert (p == MatrixParadigm.triangleSize(x));
        double bestdx = Double.POSITIVE_INFINITY;
        int bestix = -1;
        for(int y = 0; y < x; y++, p++) {
          final double v = scratch[p];
          if(v < bestd[y]) {
            bestd[y] = v;
            besti[y] = x;
          }
          if(v < bestdx) {
            bestdx = v;
            bestix = y;
          }
        }
        bestd[x] = bestdx;
        besti[x] = bestix;
      }
    }