code: def cmdscale_fast(D, ndim):
      
      tasklogger.log_debug("Performing classic MDS on {} of shape {}...".format(
          type(D).__name__, D.shape))
      D = D**2
      D = D - D.mean(axis=0)[None, :]
      D = D - D.mean(axis=1)[:, None]
      pca = PCA(n_components=ndim, svd_solver='randomized')
      Y = pca.fit_transform(D)
      return Y
docs: Fast CMDS using random SVD
  
      Parameters
      ----------
      D : array-like, input data [n_samples, n_dimensions]
  
      ndim : int, number of dimensions in which to embed `D`
  
      Returns
      -------
      Y : array-like, embedded data [n_sample, ndim]