function [tlu,tqr,tschur,tsvd] = cost(n)
% [tlu,tqr,tschur,tsvd] = cost(n)
% avg time for five tries.
% Each routine called once before timing starts, to eliminate loading effects
a  = rand(n);
t0 = clock;
[u,s,v] = svd(a);
[q,r]   = qr(a);
[u,t]   = schur(a);
[L,u,p] = lu(a);
t = etime(clock,t0);
f=1; % retain dependence on n, expected to be O(n^3)
tlu=0;
tqr=0;
tschur=0;
tsvd=0;
for i = 1:5,
    a  = rand(n);
    t0 = clock;
    [L,u,p]  =  lu(a);
    tlu = tlu + etime(clock,t0);
    t0 = clock;
    [q,r] = qr(a);
    tqr = tqr + etime(clock,t0);
    t0 = clock;
    [u,t] = schur(a);
    tschur = tschur + etime(clock,t0);
    t0 = clock;
    [u,s,v] = svd(a);
    tsvd = tsvd + etime(clock,t0);
end;
tlu = tlu/5/f;
tqr = tqr/5/f;
tschur = tschur/5/f;
tsvd = tsvd/5/f;