   function [v] = powerit0(A, nit, v) 
%% function [v] = powerit0(A, nit, v) 
%% simple version. does nit steps of power iteration 
%% starting with (input) v
%% 
for i=1:nit
    v = A*v;
    [t,k] = max(abs(v));
    alpha = v(k);
    v = v / alpha;
%%-------------------- print stats on progress 
    r = norm(A*v - alpha*v) ;
    fprintf(1,'it %3d -> r=%12.4e alph=%12.4e\n',i,r,alpha);
end

