help-octave
[Top][All Lists]
Advanced

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

Re: .oct-files/ library-wrapper


From: A. Scottedward Hodel
Subject: Re: .oct-files/ library-wrapper
Date: Fri, 19 Jan 2001 10:11:49 -0600 (CST)

args is of  type octave_value_list.  The argument type is overloaded,
so that each octave_value can be just about anything you could want.  As a
result, I wrote a few argument checking routines that are in my port of
Stephen Boyd's semidefinite programming package to Octave.  These allow
you to say things like

  // pull arguments out of passed structure.
  int errflg=0;
  Matrix FF = get_matrix(args(0),"sp: ",1,errflg);
  if(errflg) return retval; 

  ColumnVector dblksiz = get_vector(args(1),"sp: ",2,errflg);
  if(errflg) return retval;

etc. where the string is passed for diagnostic error messages.  You may
find looking at those routines helpful for unpacking passed arguments.

A S Hodel Dept. of Elect Eng, 200 Broun Hall Auburn Univ, AL 36849 (334)8441854 
FAX:-1809       http://www.eng.auburn.edu/users/scotte    address@hidden 

On Fri, 19 Jan 2001, Daniel Heiserer wrote:

> Hi,
> I have some questions according wrapping c/fortran
> libraries into octave.
> I have seen the example: (and some others)
>   
>   #include <octave/oct.h>
> 
>   DEFUN_DLD (oregonator, args, ,
>     "The `oregonator'.")
>   {
>     ColumnVector dx (3);
> 
>     ColumnVector x = args(0).vector_value ();
> 
>     dx(0) = 77.27 * (x(1) - x(0)*x(1) + x(0)
>                      - 8.375e-06*pow (x(0), 2));
> 
>     dx(1) = (x(2) - x(0)*x(1) - x(1)) / 77.27;
> 
>     dx(2) = 0.161*(x(0) - x(2));
> 
>     return octave_value (dx);
>   }
> obviously args is a list or something of the arguments
> and 
> int nargin=args.length();
> takes care of input parsing.
> How do I know what kind of datatype is args(j)?
> How do I define multiple output arguments is it the same
> by just creating a list?
> retval(1) = a;
> retval(0) = b;
> 
> return retval;
> 
> Did anybody create a mechanism how to automatically 
> wrap whole bunch of libraries into octave using
> some script?
> 
> thanks daniel
> 
> -- 
> Mit freundlichen Gruessen
>                                  Daniel Heiserer
> --------------------------------------------------------------
> Dipl.-Phys. Daniel Heiserer, BMW AG, Knorrstrasse 147, 80788 Muenchen
> Abteilung EK-20
> Tel.: 089-382-21187, Fax.: 089-382-42820
> mailto:address@hidden 
> Lageplan Standort FIZ:
> http://www.stadtplandienst.de/query?ORT=M&STR=Knorrstr.&HNR=147



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