help-octave
[Top][All Lists]
Advanced

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

Re: [Fwd: Calling Octave from C++]


From: Paul Kienzle
Subject: Re: [Fwd: Calling Octave from C++]
Date: Wed, 30 Jun 2004 23:24:07 -0400


On Jun 30, 2004, at 7:32 AM, Xavier Amatriain wrote:

But by reading this mailing list archive I see that calling Octave from
C++ is not very feasible. If I understand right there is no problem in
calling standard functions already implemented in liboctave but it is
not that easy with new .m files provided by the user.

It is certainly feasible.  It just takes more code than it should at the
moment.

I read in a mail by John Eaton the following:

" (...) if you are writing a dynamically linked function for
Octave, you could also use feval to call Octave's .m file version of
the function, but if you are writing a standalone program, that won't
work (without also loading all of Octave's interpreter, which I would
bet is more than you really want).  And in either case, if you use the
interpreted function, it will probably be a lot slower than you want (...)"

Before continuing our attempt on integrating Octave I would like to have
a clarification on the previous comment. I understand that for
standalone applications calling Octave functions it is necessary to load
the whole Octave interpreter.

Clearly.

 I think that is the way things work also
in Matlab.

I'm not sure that when you call the engine api in matlab that it is
linking against the library rather than using some form of
inter-process communication with a separately running matlab.
The octave version of these functions (available in
octave-forge/extra/engine) use pipes. to communicate.  I haven't
tested these recently --- so no guarantees that they still work.

 I understand that this makes things go much slower. But is
that the only problem?

Other than needing too much code to set up a stand-alone
interpreter, yes.

Provided that in these cases we are only talking
about rapid prototyping and efficiency is not a must, will this decrease
in speed be reasonable?

If your octave code has for loops, then I doubt you will be fast
enough to do real time analysis.  Otherwise, with a low enough
bit rate you should be fine.   If you are not after real time effects,
then even the occasional for loop should be acceptable.

 Does anyone know if it can be comparable to the
speed in doing the same operation with Matlab?

Some vector operations are faster in Octave, some are faster in
Matlab.  Due to memory thrashing, scalar operations are
slower in octave.   For simple loops, matlab's jit compiler
makes it another order of magnitude faster.

Paul Kienzle
address@hidden



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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