code: function calculateDistanceMatrix(data, distance) {
                  var distanceMatrix = new Array(data.length);
                  for (var i = 0; i < data.length; ++i) {
                      for (var j = i; j < data.length; ++j) {
                          if (!distanceMatrix[i]) {
                              distanceMatrix[i] = new Array(data.length);
                          }
                          if (!distanceMatrix[j]) {
                              distanceMatrix[j] = new Array(data.length);
                          }
                          const dist = distance(data[i], data[j]);
                          distanceMatrix[i][j] = dist;
                          distanceMatrix[j][i] = dist;
                      }
                  }
                  return distanceMatrix;
              }
docs: Calculates the distance matrix for a given array of points
  @ignore
  @param {Array<Array<Number>>} data - the [x,y,z,...] points to cluster
  @param {Function} distance - Distance function to use between the points
  @return {Array<Array<Number>>} - matrix with the distance values