code: public static Vec solveCGNR(double eps, Matrix A, Vec x, Vec b)
      {
          if(A.rows() != b.length())
              throw new ArithmeticException("Dimensions do not agree for Matrix A and Vector b");
          else if(A.cols() != x.length())
              throw new ArithmeticException("Dimensions do not agree for Matrix A and Vector x");
          
          //TODO write a version that does not explicityly form the transpose matrix
          Matrix At = A.transpose();
          Matrix AtA = At.multiply(A);
          Vec AtB = At.multiply(b);
          
          return solve(eps, AtA, x, AtB);
      }
docs: Uses the Conjugate Gradient method to compute the least squares solution to a system
  of linear equations.<br>
  Computes the least squares solution to A x = b. Where A is an m x n matrix and b is
  a vector of length m and x is a vector of length n
  
  <br><br>
  NOTE: Unlike {@link #solve(double, jsat.linear.Matrix, jsat.linear.Vec, jsat.linear.Vec) },
  the CGNR method does not need any special properties of the matrix. Because of this, slower
  convergence or numerical error can occur.
  
  @param eps the desired precision for the result
  @param A any m x n matrix
  @param x the initial guess for x, can be all zeros. This vector will be altered
  @param b the target values
  @return the least squares solution to A x = b