code: public void improve(double[] b, double[] x) {
          if (b.length != n || x.length != n) {
              throw new IllegalArgumentException(String.format("Row dimensions do not agree: A is %d x %d, but b is %d x 1 and x is %d x 1", n, n, b.length, x.length));
          }
  
          // Calculate the right-hand side, accumulating the residual
          // in higher precision.
          double[] r = b.clone();
          axpy(x, r, -1.0);
  
          // Solve for the error term.
          solve(r, r);
  
          // Subtract the error from the old solution.
          for (int i = 0; i < n; i++) {
              x[i] -= r[i];
          }
      }
docs: Iteratively improve a solution to linear equations.
  
  @param b right hand side of linear equations.
  @param x a solution to linear equations.