Is it possible to solve a non-square under/over constrained matrix using Accelerate/LAPACK? Such as the following two matrices. If any variables are under constrained they should equal 0 instead of being infinite.
So in the under constrained case: A, D & E would equal 0, while B, C & F equal -1.
In the over constrained case all variables would be equal to -1.
Under Constrained:
____ ____
| (A) (B) (C) (D) (E) (F) |
| -1 0 0 1 0 0 | 0 |
| 1 0 0 0 -1 0 | 0 |
| 0 -1 1 0 0 0 | 0 |
| 0 1 0 0 0 -1 | 0 |
| 0 1 0 0 0 0 | -1 |
|____ ____|
Over Constrained:
____ ____
| |
| -1 0 0 1 0 0 | 0 |
| 1 0 0 0 -1 0 | 0 |
| 0 -1 1 0 0 0 | 0 |
| 0 1 0 0 0 -1 | 0 |
| 0 1 0 0 0 0 | -1 |
| 0 0 1 -1 0 0 | 0 |
| 1 -1 0 0 0 0 | 0 |
|____ ____|
Yes!
The same routine will also solve over-determined systems in the least-squares sense (the result will be a minimizer of the residual ||Ax - b||).
Note that
dgels_
assumes that the matrix has full rank (i.e., rank(A) = min(m, n)). If this is not the case, you will need to use a different routine (dgelsd_
) that uses an SVD factorization instead of QR.You seem to be asking a lot of questions about LAPACK. It would be well worth your time to read the documentation.