help-octave
[Top][All Lists]
Advanced

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

strange attractor->strange crash


From: John W. Eaton
Subject: strange attractor->strange crash
Date: Wed, 11 Oct 2000 20:20:54 -0500

On 11-Oct-2000, Ben Sapp <address@hidden> wrote:

| I made a function to be dynamically linked with Octave that is nearly
| identical to the example provided in oregonator.cc and yet my function
| crashes Octave when it returns.   Here is my function:
| 
| #include <octave/oct.h>
| #include <octave/pager.h>
| #include <lo-ieee.h>
| #include <float.h>
| 
| static int a = 1;
| static int b = 1;
| static int c = 1;
| 
| DEFUN_DLD(lorenz,args, ,
| "lorenz attractor"
| )
| {
|   ColumnVector dx(3);
| 
|   ColumnVector x = ColumnVector(args(0).vector_value());
| 
| 
|   dx(1) = a*x(2)-a*x(1);
|   dx(2) = b*x(1)-x(2)-x(3)*x(1);
|   dx(3) = x(1)*x(2)-c*x(3);
|   
|   return octave_value( dx );
| }

Matrices and vectors in the Octave classes are 0-based, so you
probably want

  dx(0) = a*x(1)-a*x(0);
  dx(1) = b*x(0)-x(1)-x(2)*x(0);
  dx(2) = x(0)*x(1)-c*x(2);

instead.

jwe



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

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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