% prog2c.m -- Cholesky Factorization
% Written Oct 10, 2007 by Eric Olson for Math/CS 466/666
%
% For more information see Step 3 in First Steps in Numerical
% Analysis, 2nd Edition, by Hosking, Joe, Joyce and Turner

function prog2f
    global fid;
    disp(sprintf('prog2c.m -- Cholesky Factorization\n'));
    [fid,msg]=fopen('prog2c.dat','rt');
    if(fid==-1)
        disp(msg);
        return;
    end
    while 1
        A=getmatrix;
        if(length(A)==0)
            break;
        end
        disp(A);
        disp('');

%       add code here

    end
    fclose(fid);

function A=getmatrix
    global fid
    [n,r]=fscanf(fid,'%d',1);
    if(r==0 || n==0)
        A=[];
        return;
    end
    A=fscanf(fid,'%g',[n,n]);
