1 function UO = improve_conditioning(U,K);
2 %
function UO = improve_conditioning(U,K);
4 %
function performing svd of U, therefore making columns of U more
6 % independent. Finally, the UO columns are scaled wrt its K-norm.
7 % Note that
this is
"normalization" wrt the K-scalarproduct, but
8 % NOT orthogonalization wrt K, but only orthogonalization wrt. the
9 % Euclidean scalar product.
11 % Bernard Haasdonk 28.2.2012
13 if (cond(U
'*K*U)>1e6);
14 % disp('improving conditioning!
');
16 % perform not exact orthongonalization, but
17 % conditioning improvement.
21 unorminv = (sqrt(sum((K * UO).*UO,1))).^(-1);
22 UO = UO * diag(unorminv(:));
23 % disp(['new cond=
',num2str(cond(UO'*K*UO))]);
24 %% the following performs repeated qr orthogonalization
25 %UO = orthonormalize_qr(U,K,eps);
27 %e = (max(max(abs(KN-eye(size(KN))))));
29 % disp('PERFORMING REPEATED ORTHONORMALIZATION
');
30 % disp('Detected orthonormalization accuracy problem.
');
31 % UO = orthonormalize_qr(UO,K,2e-16);
33 % e = (max(max(abs(KN-eye(size(KN))))));
34 % % error(
'error in orthonormalization, please check!');