help-octave
[Top][All Lists]
Advanced

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

Re: Calling octave functions from oct-files


From: kensmith
Subject: Re: Calling octave functions from oct-files
Date: Sun, 27 Jan 2008 10:06:42 -0800
User-agent: KMail/1.9.1

On Wednesday 16 January 2008 21:21, Evan wrote:
> On Jan 17, 2008 12:16 AM, Przemek Klosowski 
<address@hidden> wrote:
[....]
> The problem in which I am involved is like this, first I write my
> program completely in octave scripts. Then I found it too slowly
> because there are loops in a function and these loops cannot be
> vectorized. So I want to rewrite the function in oct-file. However,
> in the function there is a definition of a function handle.

How about this for a wild idea:

Make a template oct-file.

At run time create a new oct-file with the function body inserted where 
the handle would normally needed.

The first time the new oct-file is used, the compiler processes it from 
the ground up.

After the first loop through the code, the compiler has already 
processed the file so it goes quickly.

> I would 
> have rewritten this definition in complete C++ code too if I know
> how. Because I don't know how to define a function handle from
> another, I fall back on feval and eval_string expecting that in
> oct-files they would be as fast as in octave scripts, and the loops
> in oct-file would be much faster than that in octave script, so I
> would finally get a faster oct-file. Unfortunately, the defined
> function handle is used in the loops and cause the loops even slower
> than when it is in octave scripts (I know this because if I call from
> the oct-file an octave script to accomplish the definition of the
> function handle instead of using feval and eval_string, the loops
> would be very fast).
>
> That's why I am seeking methods of defining a function handle in
> oct-files without using feval or eval_string.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave

-- 
address@hidden


reply via email to

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