code: private double[][] expd(double[][] D, double perplexity, double tol) {
          int n          = D.length;
          double[][] P   = new double[n][n];
          double[] DiSum = Math.rowSums(D);
  
          int nprocs = MulticoreExecutor.getThreadPoolSize();
          int chunk = n / nprocs;
          List<PerplexityTask> tasks = new ArrayList<>();
          for (int i = 0; i < nprocs; i++) {
              int start = i * chunk;
              int end = i == nprocs-1 ? n : (i+1) * chunk;
              PerplexityTask task = new PerplexityTask(start, end, D, P, DiSum, perplexity, tol);
              tasks.add(task);
          }
  
          try {
              MulticoreExecutor.run(tasks);
          } catch (Exception e) {
              logger.error("t-SNE Gaussian kernel width search task fails: {}", e);
          }
  
          return P;
      }
docs: Compute the Gaussian kernel (search the width for given perplexity.