Details

Type: Improvement

Status: Closed

Priority: Minor

Resolution: Fixed

Affects Version/s: 3.2

Fix Version/s: 3.3

Labels:None
Description
I don't have a complete solution to this, so don't commit this asis, but posting in case someone can get it over the line.
If you process a tall m x n matrix (nonsquare, m>n) with QRDecomposition and then call getSolver().getInverse(), you will get DimensionMismatchException. There's not a good reason the QR decomposition can't compute the leastsquares solution here.
The issue is that it tries to invert A by solving AX = I. The dimension of I has to match the row dimension of A, or m. However it's using the length of the diagonal of R, which is min(m,n), which is n when m>n.
That patch is simple and is part of the attached patch. It also includes a test case for a tall matrix.
However it doesn't work for a fat matrix (m<n). There's a test case for that too. It returns an n x m value but the rows for i >= m are 0 and are not computed. I'm not sure enough about the shape of the computation to be able to fix it, but it is where it's solving the triangular system Rx = y.
Closing all resolved issue now available in released 3.3 version.