function table4_11

%%% ic=1: randon starting matrix
%%% ic=2: Vandermonde matrix
ic=2;

% interations for increasing size of matrix
fprintf('\n n  \t   RGS \t\t  MGS  \t\t kappa ')
for in=1:10
    if ic==1
        n=2^in;
        B=rand(n,n);
    else
        n=2*in;
        B=zeros(n,n);
        for i=1:n
            a=1/i;
            B(i,1)=1;
            for j=2:n
                B(i,j)=a^(j-1);
            end
        end
    end

    % iterations for two procedures
    BB=B;
    c=cond(B,inf);
    B(:,1)=B(:,1)/norm(B(:,1),2);
    BB(:,1)=B(:,1);
    for j=2:n
        % GS version
        e=B(:,j);
        for k=1:j-1
            r=dot(B(:,j),B(:,k));
            e=e-r*B(:,k);
        end
        % MGS version
        B(:,j)=e/norm(e,2);
        ee=BB(:,j);
        for k=1:j-1
            r=dot(ee,BB(:,k));
            ee=ee-r*BB(:,k);
        end
        BB(:,j)=ee/norm(ee,2);
    end

    a=norm(B'*B-eye(n),2);
    aa=norm(BB'*BB-eye(n),2);

    fprintf('\n %i \t %5.2e  \t %5.2e  \t %5.2e',n,a,aa,c)
    %fprintf('\n %i & %5.2e  & %5.2e  & %5.2e',n,a,aa,c)
end
fprintf('\n\n')









