function gamma = hager(B,kl); % % Hager's condition estimator to estimate the 1-norm of % a matrix B. % [m,n] = size(B); x = ones(n,1)/n; for k = 1:kl y = B * x; xi = sign1(y); z = B' * xi; if (max(abs(z)) < (z' * x)) gamma = norm(y,1); return else [zj,j] = max(abs(z)); x = zeros(n,1); x(j) = 1; end end gamma = norm(B * x, 1); return function y = sign1(x) % % defines a sign function % y = x; n = length(x); for k = 1:n if (x(k) < 0) y(k) = - 1; else y(k) = 1; end end return