octave-maintainers
[Top][All Lists]
Advanced

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

Re: Octave vs Scilab


From: Fotios Kasolis
Subject: Re: Octave vs Scilab
Date: Thu, 7 Oct 2010 00:06:00 +0200



--------------------------------------------------
From: "John W. Eaton" <address@hidden>
Sent: Wednesday, October 06, 2010 11:40 PM
To: "Fotios Kasolis" <address@hidden>
Cc: "Jaroslav Hajek" <address@hidden>; <address@hidden>
Subject: Octave vs Scilab

On  6-Oct-2010, Fotios Kasolis wrote:

| So I did not manage to reproduce the example which was like 3 times faster
| but here is another example (not that bad)
|
| Windows 7 with binaries Octave 3.2.4 and Scilab 5.2.2 on intel i7 720
|
| octave.exe:1> xmpl
| 32.430
|
| ->exec('C:\Users\fotios\Desktop\xmpl.sce', -1)
| 22.411
|
| where xmpl contains the very intelligent code shown below
| N = 2000
| A = zeros(N,N);
| tic();
| for i = 1:N
|   for j = 1:N
|     A(i,j) = i^2 + j^2;
|   end
| end
| time = toc();
| disp(time)

On my system with the most recent Octave snapshot (3.3.52) I see
31.422 seconds for Octave and 32.9 seconds for Scilab.  And for the
more intelligent

 tic ();
 N = 2000;
 tmp = (1:N).^2;
 A = repmat (tmp, N, 1) + repmat (tmp', 1, N);
 toc ();

I get about .2 seconds for Octave and and error about repmat being
undefined in Scilab.  Using kron instead:

 tic ();
 N = 2000;
 t1 = (1:N).^2;
 t2 = ones (N, 1);
 A = kron (t1, t2) + repmat (t1'; t2');
 toc ();

I get approximately the same results from Octave and

                                                           !--error 17
: stack size exceeded (Use stacksize function to increase it).

from Scilab the first time I tried it, then it crashed with a segfault
on the second attempt (not that I thought the stack size problem would
go away, I just wanted to see what would happen).

jwe


The code for scilab with equivalent to repmat example is

A = ones(N,1).*.tmp + ones(1,N).*.tmp'

and in my machine is (as I expected Octave will be the winner)

0.05 for Octave and ;D
0.18 for Scilab

However, my point is not to find a good implementation in that case, but instead, to compare the interpreter.

/Fotis


reply via email to

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