_zero_S_diag = (S_diag ~= 0);
S_diag_inv = S_diag;
S_diag_inv(idx_non_zero_S_diag) = S_diag_inv(idx_non_zero_S_diag).^(-1);
S_inv = [diag(S_diag_inv); zeros(size(S,2)-size(S,1),size(S,1))]

%%
% Find the Pseudo inverse:
A_inv = V*S_inv*U'

%%
% Measure inversion error:
err_inv = norm(A_inv * A  - eye(size(A,2)))



##### SOURCE END #####
--></body></html>