code: public static void pdist(double[][] x, double[][] dist, boolean squared, boolean half) {
          int n = x.length;
  
          if (n < 100) {
              for (int i = 0; i < n; i++) {
                  for (int j = 0; j < i; j++) {
                      double d = distance(x[i], x[j]);
                      dist[i][j] = d;
                      dist[j][i] = d;
                  }
              }
          } else {
              int nprocs = Runtime.getRuntime().availableProcessors();
              List<PdistTask> tasks = new ArrayList<>();
              for (int i = 0; i < nprocs; i++) {
                  PdistTask task = new PdistTask(x, dist, nprocs, i, squared, half);
                  tasks.add(task);
              }
              ForkJoinPool.commonPool().invokeAll(tasks);
          }
      }
docs: Pairwise distance between pairs of objects.
  @param x Rows of x correspond to observations, and columns correspond to variables.
  @param squared If true, compute the squared Euclidean distance.
  @param half If true, only the lower half of dist will be referenced.
  @param dist The distance matrix.