code: public void solve(DenseMatrix B) {
          if (!full) {
              throw new IllegalStateException("This is not a FULL singular value decomposition.");
          }
  
          if (B.nrows() != m) {
              throw new IllegalArgumentException("Dimensions do not agree.");
          }
  
          double[] b = new double[m];
          double[] x = new double[n];
          int p = B.ncols();
          for (int j = 0; j < p; j++) {
              for (int i = 0; i < m; i++) {
                  b[i] = B.get(i, j);
              }
  
              solve(b, x);
              for (int i = 0; i < n; i++) {
                  B.set(i, j, x[i]);
              }
          }
      }
docs: Solve the least squares A * X = B. B will be overwritten with the solution
  matrix on output.
  @param B    right hand side of linear system. B will be overwritten with
  the solution matrix on output.
  @exception  RuntimeException  Matrix is rank deficient.