Solve a linear system of equations, A*x=b, using dgelss lapack function.
This function mainly transfers the MBsysC arrays with index starting at 1 (see get_dmat_1() and get_dvec_1()) to Lapack-compatible arrays (index starting at 0, col. major memory).
The following explanations come from the Lapack documentation. This function solves overdetermined or underdetermined systems.
For overdetermined system it minimizes 2-norm(| b - A*x |).
For underdetermined system it minimizes 2-norm(| x |).
- Parameters
-
[in,out] | A | main matrix of size [x,y] with first line and row unused using row major memory. |
[in,out] | b | As input it contains the vector b of size [y] with index starting at 1. As output it contains the solution vector x. |
For overdetermined system, the residual sum-of-squares for the solution is the sum of the elements from b[x+1] to b[y+1].
- Parameters
-
[in] | x | the number of row of A, which is the number of equations. |
[in] | y | the number of col. of A, which is the number of unknowns. |
- Returns
- error status, < 0 in case of failure.