[Top][All Lists]

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

Re: Matlab compatibility: quad (Was: Re: lsim problem)

From: David Bateman
Subject: Re: Matlab compatibility: quad (Was: Re: lsim problem)
Date: Thu, 21 Oct 2004 10:54:38 +0200
User-agent: Mutt/1.4.1i

According to Gerrit <address@hidden> (on 10/21/04):
> I tried to compile Octave from latest CVS, but it exits with an error:
> lex.l: In function `int is_keyword_token(const std::string&)':
> lex.l:1216: error: ISO C++ forbids declaration of `octave_kw' with no type
> lex.l:1216: error: uninitialized const `octave_kw'
> lex.l:1216: error: syntax error before `*' token
> (with many 'undeclared' errors afterwards)

To run from the CVS you need to have gperf installed so that the file
octave.gperf can be compiled into oct-gperf.h. This is already done
for you in a distribution. Running from the CVS you also need to run before configure to ensure that the configuration script is

> Because of this, I tried to use Octave 2.1.50, which was already
> installed on my system. I have a Matlab compatibility issue though.
> In Matlab, 'quad' takes a 6th argument. This argument is used to pass
> additional arguments to the function to be integrated. Octave doesn't
> have this argument. Is there a clean and simple workaround? I tried to
> define many different functions in a loop, but according to my teacher,
> my results are wrong, and suspect this is the cause. Simple is better
> than complex, and my workaround was rather complex. Is there a better
> one?

Even in the CVS this behaviour hasn't changed... It would be easy to 
create a "static octave_value_list" in the code and use it to
store the additional arguments. Something like

      static octave_value_list octave_quad_extra_args;
      static int octave_quad_num_extra_args = 0;
      quad_user_function (double x)
        double retval = 0.0;
        octave_value_list args;
        args(0) = x;
        for (int i = 0; i < octave_quad_num_extra_args; i++)
          args (i+1) = octave_quad_extra_args (i);

and appropriate code in Fquad to store the args.. However the downside
would be that this would make recursive calls to quad even more unlikely
to happen. Not that recursive calls to quad are possible at the moment.


David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

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]