code: public static void generateIPC(double[] std_deviation, double totVar, double[] vars, double[] prop_var,
                                     double[] cum_var) {
          int arrayLen = std_deviation.length;
  
          if (totVar > 0) {
              for (int i = 0; i < arrayLen; i++) {
                  vars[i] = std_deviation[i] * std_deviation[i];
                  prop_var[i] = vars[i] / totVar;
                  cum_var[i] = i == 0 ? prop_var[0] : cum_var[i-1] + prop_var[i];
              }
          }
          double lastCum = cum_var[arrayLen-1];
          if (lastCum > 1) {  // GLRM sometimes screw up the matrix estimation pretty bad
              double multF = 1/lastCum;
              ArrayUtils.mult(prop_var, multF);
              ArrayUtils.mult(cum_var, multF);
              ArrayUtils.mult(vars, multF);
              ArrayUtils.mult(std_deviation, sqrt(multF));
          }
      }
docs: This method will calculate the importance of principal components for PCA/GLRM methods.
  
  @param std_deviation: array of singular values
  @param totVar: sum of squared singular values
  @param vars: array of singular values squared
  @param prop_var: var[i]/totVar for each i
  @param cum_var: cumulative sum of var[i]/totVar from index 0 to index i.