[Top][All Lists]

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

Re: Hi, another newbie ...

From: Paul Kienzle
Subject: Re: Hi, another newbie ...
Date: Thu, 19 Dec 2002 23:15:39 -0500

----- Original Message -----
From: "Andrzej M. Ostruszka" <address@hidden>
To: <address@hidden>
Sent: Thursday, December 19, 2002 7:26 AM
Subject: Hi, another newbie ...

> Hi,
> I've just started to play more seriously with octave (I've used Matlab
> for long time) and I have couple of questions regarding "native code"
> functions (I have no problems with *.m files) -- I did run search in
> mail archive but somehow couldn't find anything relevant.
> 1. I can use in C++ methods which are internal to given objects for
>    example
> DEFUN_DLD (testexpm, args, /* nargout */, "Some `testing' function")
> {
>   ComplexMatrix m( args(0).complex_matrix_value() );
>   return octave_value( m.expm() );
> }
> but how can I use other functions (including those defined in *.m)
> inside say this testexpm.  I just realized that I could use feval (am
> I correct?),

Yes.  You will need to make an octave value list for you input parameters
and your returned parameters will be in an octave_value_list so it is a
little bit ugly but not too difficult.  You can also call eval, which in
cases may be a little easier..

> but the question is more general: how can I access
> variables defined in current context (or at least global) and how can
> I pass/register my local variables to the "rest of the world".

Look in for get/set_global_value.  Code for symbols in the
current function will be similar except that it will use curr_sym_tab
of global_sym_tab.

> 2. How can I use liboctave in separate programs?  My problem is that
>    I don't know why it doesn't find definitions of various functions.
>    I've managed to reduce problem to finding say constructor and expm
>    of ComplexMatrix when I link with:
>      -lm -lg2c -lblas -llapack -lcruft -loctave -ldl -lfftw

Do you have a small program you can share which reproduces the error?

>    The above is on my home computer with PLD Linux 1.0 distribution
>    while here in my work (RedHat 7.3) I had to supply additionally
>    readline ncurses kpathsea (which I guess is incompatible with the one
>    which liboctave was linked with since there's one unresolved symbol
>    left -- but that doesn't matter I can run programs in home).
>    The problem is that if I do `nm' than I can see something
>    of the kind (I'm not that good in demangling so I might be wrong :))
> 00126960 W __13ComplexMatrix
> 00126cd0 W __13ComplexMatrixPt7complex1Zdii
> 00109140 T __13ComplexMatrixRC10DiagMatrix
> 00109a80 T __13ComplexMatrixRC10boolMatrix
> 00109cf0 T __13ComplexMatrixRC10charMatrix
> 00108ee0 T __13ComplexMatrixRC12ColumnVector
> 00126b10 W __13ComplexMatrixRC13ComplexMatrix
> 00109390 T __13ComplexMatrixRC16ComplexRowVector
> 00109830 T __13ComplexMatrixRC17ComplexDiagMatrix
> 001095e0 T __13ComplexMatrixRC19ComplexColumnVector
> 00108970 T __13ComplexMatrixRC6Matrix
> 00108c80 T __13ComplexMatrixRC9RowVector
> ....
> 00114ec0 T expm__C13ComplexMatrix
> 00147990 T expm__C6Matrix
>    which makes me think that I'm doing something wrong but I don't see
>    what.  Additionally I'd like to access other octave functions
>    (defined as *.m or *.oct or even builtin) but I guess that the answer
>    for my first question also aswers that one.

Once you are trying to call .m files you might as well use an oct file since
have to have almost all the machinery of octave available to do so.  There
a few cases in which you might not want to do so, such as when you need your
own event loop, but to do that we need to rework the octave toplevel code
a bit.

Paul Kienzle

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

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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