compare the executive speed with Matlab

wim van hoydonck wim.van.hoydonck at gmail.com
Mon Jan 5 02:50:15 CST 2009


On 1/3/09, Sergei Steshenko <sergstesh at yahoo.com> wrote:
>
>
>
>  --- On Fri, 1/2/09, wim van hoydonck <wim.van.hoydonck at gmail.com> wrote:
>
>  > From: wim van hoydonck <wim.van.hoydonck at gmail.com>
>
> > Subject: Re: compare the executive speed with Matlab
>  > To: sergstesh at yahoo.com
>
> > Cc: "John W. Eaton" <jwe at octave.org>, help at octave.org, "Howard" <shj1130 at pchome.com.tw>
>
>  [snip]
>
>
>  >   angles = real( [(i, i=0,n-1)]/n , kind=dp )
>
>
> [snip]
>
>  'pi' appears to be missing in the line above, but I'm unfamiliar with
>  f90 syntax, so I do not know how fix the line, probably
>
>   angles = real( pi * [(i, i=0,n-1)]/n , kind=dp )
>
>  Regards,
>
>   Sergei.
>
>
>
>

Hi Sergei,

You are right, 'pi' was in the wrong place.

About the timing differences:
It might be that, due to optimizations, ifort already calculates the
result (the sinus of the angles) at compile time (as that is something
that can be calculated in advance), but I am not sure about that.

Anyway, the speed difference here is not that big, it becomes more
apparent with larger programs that contain multiple for/do loops.
I've seen a speed increase of 1000 between matlab and fortran on a
program that contained a double loop, from 25 minutes of calculation
time to 1.5 seconds...

But there are obviously also nontrivial problems where fortran
(gfortran, ifort,...) is not faster and even slower (see here:
http://shootout.alioth.debian.org/gp4/).

Greetings,

wim


More information about the Help-octave mailing list