help-octave
[Top][All Lists]
Advanced

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

Re: calling a DLD function from another DLD function


From: Quentin Spencer
Subject: Re: calling a DLD function from another DLD function
Date: Wed, 01 Feb 2006 10:09:41 -0600
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

Carlo de Falco wrote:

It is about as efficient as calling a .oct file function from Octave.

If the functions are defined in the same .oct file, then you can use a
more direct route.  But if they are not in the same file, you may have
unpredictible results, so it is best to use feval to handle the
function (.oct file) lookup.

jwe


John,
Thank you very much for your reply!
If I understand correctly this is not efficient
enough for my case.
Probably I am just following a completely wrong
approach, let me explain in more detail what I need to do:

I have a set of functions in m-files, say fa.m, fb.m and fc.m
that I want to convert to c++ for better performance.

they something look like

-----
function out = fa(in)

 for ii=1:bigumber
   for jj=1:bigumber
     -- compute some stuff --
     out(ii,jj) = fb(somestuff)
   end
 end

endfunction
-----
function out = fb(in)

 for ii=1:bigumber
     -- compute some stuff --
     out += fc(somestuff)
 end

endfunction
-----

and I would like fa, fb and fc all to be available
as commands from the octave prompt.

Probably my approach of making a .oct file
for each function juast makes no sense.

Do you have any alternatives?
Carlo

I think I have done something like this before. My approach would be to make each of the functions written in plain C and then write DLD wrapper functions around them. Then the functions can call each other using the low-level C function calls, and all of them are also available to be called from m files.

-Quentin



-------------------------------------------------------------
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]