Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Octave vs Matlab ?
Replies: 1   Last Post: Feb 24, 1997 1:56 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
John W. Eaton

Posts: 68
Registered: 12/7/04
Re: Octave vs Matlab ?
Posted: Feb 24, 1997 1:56 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <blattner-2402971446520001@mac03-14.unine.ch>,
Blattner Peter <blattner@imt.unine.ch> wrote:

: is there any significant difference between Octave and Matlab in respect
: of speed ?

I suppose it depends on what you want to do. If you want to know what
the differences are for problems you might care about, why not run
some tests for yourself?

Here is a comparision of a couple of simple things. I ran this on an
HP 700 series machine.

Octave 2.0.x Matlab 4.2
------------ ----------

3 nested loops 31.81 9.85 (CPU seconds)

rand, svd, inv, lu 0.14 0.18
(once)

rand, svd, inv, lu 9.59 18.33
(1 loop, 100 times)

rand, svd, inv, lu 9.57 18.32
(2 nested loops,
100 times total)

Here is the code I used for the test:

t = cputime;
for n = 1:10; for m = 1:100; for k = 1:100;
x = n*m^2*k^3;
end; end; end
cputime-t

k = 50; n = 100;
t = cputime;
x = rand (k); [u, s, v] = svd (x); y = inv (x); [l, u, p] = lu (x);
cputime-t

t = cputime;
for i = 1:n
x = rand (k); [u, s, v] = svd (x); y = inv (x); [l, u, p] = lu (x);
end
cputime-t

n = 10; m = 10;
t = cputime;
for i = 1:n; for i = 1:m
x = rand (k); [u, s, v] = svd (x); y = inv (x); [l, u, p] = lu (x);
end; end
cputime-t

I'm sure that Octave's interpreter could be made to run a lot faster,
particularly for loops and function calls. So far, I've concentrated
on making it produce correct results with code that is reasonably easy
to maintain.

I'm somewhat surprised by the difference in performance for the simple
linear algebra functions. In this particular case, Octave is using
standard Fortran LAPACK and BLAS routines, and I've done nothing to
try to improve their performance.

BTW, while I was trying this, I found that Matlab would not accept

cputime - t

or

cputime() - t

so I was forced to write something like

cputime-t

or

(cputime) - t

Is this a bug?


Thanks,

jwe

--
In the beginning, Ken Thompson | Octave: http://www.che.wisc.edu/octave
wrote the searching tool grep. | Me: http://www.che.wisc.edu/~jwe
-- A. Hume, SP&E (1988) |






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2010. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Goodwin College of Professional Studies.