Searching the Octave user manual, the email archives, and the Web, I can
find examples in which Octave built-in functions are called from C++ but
none from C.
There is mention that it can be done but I haven't been able to find any
examples in which C is the calling language.
The task is to call the polyfit and polyval functions from a C
function. I've implemented this from C to Matlab but don't see how it
is done with Octave.
I want to call these functions directly, without use of the Octave
interpreter. I found a discussion on the Web in which it is stated that
built-in functions can be called without use of the interpreter and for
performance reasons would prefer this approach if possible.
Am 26.01.19 um 03:29 schrieb Allan Branscomb:
> The task is to call the polyfit and polyval functions from a C
> function ... I want to call these functions directly, without use of the Octave
Have you had a look how these functions are implemented in GNU Octave?
You won't be able to run these without interpreter.
I think the best option for you is to pick one of the many C libraries
which can do that, for example GSL - GNU Scientific Library
> On 1/26/19 3:02 AM, Carlo De Falco wrote:
>>> On 26 Jan 2019, at 03:29, Allan Branscomb <[hidden email]>
>>> There is mention that it can be done but I haven't been able to find any examples in which C is the calling language.
>> Where did you find mention of that? builtin functions are declared as :
>> extern OCTINTERP_API octave_value_list
>> Fnorm (const octave_value_list& = octave_value_list (), int = 0);
>> and "octave_value_list" is definitely not a C compatible type ...
> On 27 Jan 2019, at 17:15, Allan Branscomb <[hidden email]> wrote:
> The reference is found here: http://www.obihiro.ac.jp/~suzukim/masuda/octave/html3/octave_193.html
that is a very old version of the Octave manual from more tha 10 years ago!
The updated manual is here :
> " These are highly optimized and many do not carry the overhead of being interpreted."
Where does that say you can call builtins from a C standalone program?
It does say you can call C code from Octave, but that is not what you want, right?
> However, I was concerned with calling Octave just two commonly used functions from standalone C, not calling C functions from within Octave and was trying to determine if it also would be possible to avoid use of the interpreter by calling them from C outside of the Octave environment.
That is definitely possible for C++. I don't think it is easy to do from C.
On the other hand, many Octave built-in functions are not implemented from scratch but rather use backend libraries.
Many such libraries are written in C or F77 so, if you specify what functions you want to use we might direct you to the libraries that Octave uses to implement them.