Create the augmented matrix of A.
This is given by
[c * eye(m, m), A; A', zeros(n, n)]
This is related to the least squares solution of
A \ b
, by
s * [ r / c; x] = [ b, zeros(n, columns(b)) ]
where r is the residual error
r = b - A * x
As the matrix s is symmetric indefinite it can be factorized with
lu
, and the minimum norm solution can therefore be found without the
need for a qr
factorization. As the residual error will be
zeros (m, m)
for underdetermined problems, and example
can be
m = 11; n = 10; mn = max (m, n); A = spdiags ([ones(mn,1), 10*ones(mn,1), -ones(mn,1)], [-1, 0, 1], m, n); x0 = A \ ones (m,1); s = spaugment (A); [L, U, P, Q] = lu (s); x1 = Q * (U \ (L \ (P * [ones(m,1); zeros(n,1)]))); x1 = x1(end - n + 1 : end);
To find the solution of an overdetermined problem needs an estimate of the
residual error r and so it is more complex to formulate a minimum norm
solution using the spaugment
function.
In general the left division operator is more stable and faster than using
the spaugment
function.
See also: mldivide.
Package: octave