docs: public static double Mahalanobis(double[][] A, double[][] B) {
  
          if (A[0].length != B[0].length)
              throw new IllegalArgumentException("The number of columns of both matrix must be equals.");
  
          double[][] subA = new double[A.length][A[0].length];
          double[][] subB = new double[B.length][B[0].length];
  
          //Center data A
          double[] meansA = new double[A[0].length];
          for (int j = 0; j < A[0].length; j++) {
              for (int i = 0; i < A.length; i++) {
                  meansA[j] += A[i][j];
              }
              meansA[j] /= (double) A.length;
              for (int i = 0; i < A.length; i++) {
                  subA[i][j] = A[i][j] - meansA[j];
              }
          }
  
          //Center data B
          double[] meansB = new double[B[0].length];
          for (int j = 0; j < B[0].length; j++) {
              for (int i = 0; i < B.length; i++) {
                  meansB[j] += B[i][j];
              }
              meansB[j] /= (double) B.length;
              for (int i = 0; i < B.length; i++) {
                  subB[i][j] = B[i][j] - meansB[j];
              }
          }
  
          //Matrix of covariance
          double[][] covA = Covariance(subA);
          double[][] covB = Covariance(subB);
  
          //Pooled covariance
          double rows = subA.length + subB.length;
          double[][] pCov = new double[covA.length][covA[0].length];
          for (int i = 0; i < pCov.length; i++) {
              for (int j = 0; j < pCov[0].length; j++) {
                  pCov[i][j] = covA[i][j] * ((double) subA.length / rows) + covB[i][j] * ((double) subB.length / rows);
              }
          }
  
          //Inverse of pooled covariance
          pCov = Matrix.Inverse(pCov);
  
          //compute mean difference
          double[] diff = new double[A[0].length];
          for (int i = 0; i < diff.length; i++) {
              diff[i] = meansA[i] - meansB[i];
          }
  
          return Math.sqrt(Matrix.InnerProduct(Matrix.MultiplyByTranspose(pCov, diff), diff));
  
      }