Some of this may just be your computer. For example, for p = inf,
norm(A,inf) was 3x faster for me:
tic;
n1=max(sum(abs(A),2));
toc;
tic;
n2=norm(A,inf);
toc;
Elapsed time is 0.027940 seconds.
Elapsed time is 0.009856 seconds.
You're right about norm slowing down from using SVD. Sometimes you can avoid
that by using norm(A,'fro'), which doesn't use SVD (but also calculates a
slightly different quantity):
>> tic; norm(A); toc
Elapsed time is 3.369329 seconds.
>> tic; norm(A,'fro'); toc
Elapsed time is 0.044764 seconds.
"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message
news:kp8a7m$ov1$1@newscl01ah.mathworks.com...
> Below, I've tested matrix norm calculations via norm(A,p) with p=1,2,inf
> against more conventional implementations. Except for the p=1 norm, the
> NORM command seriously lagged behind the alternative in speed performance.
> Why is this, and shouldn't the implementation of NORM be changed to get
> the better performance?
>
> A=rand(2000);
> %%p=1
> tic;
> n1=max(sum(abs(A),1));
> toc;
> tic;
> n2=norm(A,1);
> toc;
> Elapsed time is 0.011953 seconds.
>
> Elapsed time is 0.003040 seconds.
>
> %%p=2
> tic;
> n1=sqrt( max( eig(A.'*A) ) );
> toc;
> tic;
> n2=norm(A);
> toc;
> Elapsed time is 1.219832 seconds.
>
> Elapsed time is 3.126588 seconds.
>
> %%p=inf,
> tic;
> n1=max(sum(abs(A),2));
> toc;
> tic;
> n2=norm(A,inf);
> toc;
> Elapsed time is 0.016016 seconds.
>
> Elapsed time is 0.038478 seconds.
>
> I think I might understand why the p=2 case is so slow. NORM is using
> svd(), which is slower than eig, but possibly more stable numerically.
> However, I cannot understand why it is so much faster than the direct
> implementation for p=1 and so much slower for p=inf.
