help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MacOSX: Octave.app 2.9.14


From: David Bateman
Subject: Re: MacOSX: Octave.app 2.9.14
Date: Thu, 04 Oct 2007 00:02:45 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Quentin Spencer wrote:
> John W. Eaton wrote:
>> On 30-Sep-2007, Dmitri A. Sergatskov wrote:
>>
>> | Another speedup can be done if we make a norm (x,1) a special case,
>> | so instead of calculating:
>> | | octave:29> tic; sum((abs(x) .^1))^1 ; toc
>> | Elapsed time is 0.174812 seconds.
>> | | We can simply calculate:
>> | | octave:30> tic; sum((abs(x))) ; toc
>> | Elapsed time is 0.080658 seconds.
>>
>> Patches, anyone?
>>   
> 
> It looks like it should be as simple as this.
> Quentin

However, the issue is the overhead in the norm function itself rather
than the formulation like the above. For even reasonable sized vectors
this is an issue

octave:1> x = randn(500,1);
octave:2> tic; norm(x); toc
Elapsed time is 0.128288 seconds.
octave:3> tic;sqrt(sum(abs(x).^2));toc
Elapsed time is 0.043961 seconds.
octave:4> tic;__vnorm__ (x, 2);toc
Elapsed time is 0.043579 seconds.

So all the additional tests (even probably this one you added Quentin)
is just likely to slow things up.. This is why I felt __vnorm__ should
perhaps be given the status of a real rather than internal function..

D.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]