Compute least squares using java
I am trying to find a java code to compute the least squares solution (x) in the Ax=b equation. Suppose that A = [1 0 0;1 0 0]; b = [1; 2]; x = A\b returns the x = 1.5000 0 0 I found Class LeastSquares, public LeastSquares(double[] a, double[] b, int degree) but in the input both A and B are one dimensional arrays, however, in above example, A is a matrix and B is an array. In Class NonNegativeLeastSquares public NonNegativeLeastSquares(int M, int N, double a[][],double b[]) A is a matrix and B is an array, but the description of the class says that it finds an approximate solution to the