[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MacOSX: Octave.app 2.9.14
From: |
Dmitri A. Sergatskov |
Subject: |
Re: MacOSX: Octave.app 2.9.14 |
Date: |
Sun, 30 Sep 2007 22:15:31 -0500 |
On 9/30/07, Vic Norton <address@hidden> wrote:
> Obviously the situation is not as extreme on your system as mine,
> Dimitri, but, even on your system, doesn't it bother you that a basic
> function takes almost twice as long as a long-hand expression for
> what it should be doing?
>
Well, norm() is more general function so it does more
work than what may appear necessary. In particular it does
not assume that x is real so it computes norm as
sqrt(sum(abs(x) .^2)). This extra call to abs adds some time;
also x .* x seems to be faster than x.^2, so perhaps
this change can be done.
octave:16> tic; sqrt(x .^2); toc
Elapsed time is 0.232262 seconds.
octave:17> tic; sqrt(x .* x); toc
Elapsed time is 0.124413 seconds.
octave:18> tic; sqrt(x .^2); toc
Elapsed time is 0.229683 seconds.
octave:19> tic; sqrt(abs(x) .^2); toc
Elapsed time is 0.247276 seconds.
octave:20> tic; sqrt(abs(x) .* abs(x)); toc
Elapsed time is 0.219238 seconds.
octave:21> tic; y=abs(x); sqrt(y .* y); toc
Elapsed time is 0.193405 seconds.
> Regards,
>
> Vic
>
Regards,
Dmitri.
--