I have the following MATLAB snippet:
>> R = randn(3000,6000); % build a random 3000 by 6000 matrix
>> tic; norm(R, 1); toc;
Elapsed time is 0.005586 seconds.
>> tic; norm(R, 2); toc;
Elapsed time is 3.019667 seconds.
>> tic; norm(R, inf); toc;
Elapsed time is 0.005393 seconds.
>>
My question is, why would the L2 norm computation be that much slower than the L1 or L infinity norm? This is a random matrix for testing purposes, of course, but for the actual matrix in my work I can see a similar pattern in terms of elapsed time.
However, on Julia, the results are as follows
julia> @time norm(R, 1);
0.007156 seconds (1 allocation: 16 bytes)
julia> @time norm(R, 2);
0.009142 seconds (1 allocation: 16 bytes)
julia> @time norm(R, Inf);
0.034633 seconds (1 allocation: 16 bytes)
This makes no sense at all. Any help is appreciated!