% Optical Imaging and Spectroscopy
%
% David J. Brady
% Duke University
% www.opticalimaging.org
%
% % function written by Nikos Pitsianis, ECE Dept, Aristotle University
%
function x = minLS(A,b)
% min length LS
%
%
% Nikos Pitsianis
% 8/16/2004
%

[m,n] = size(A);
r = rank(A);

[U,S,V] = svd(A);

x = V(:,1:r) * (diag(1./diag(S(1:r,1:r))) * (U(:,1:r).'*b));

