help-octave
[Top][All Lists]
Advanced

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

LSODE_options


From: John W. Eaton
Subject: LSODE_options
Date: Tue, 22 Jun 1999 11:59:53 -0500 (CDT)

On 22-Jun-1999, Luigi Palopoli <address@hidden> wrote:

| Hello everybody,
| I am trying to do simulations using directly the octave library. Since
| 100000 are not seemingly enough for the tolerances I need, an breaking
| the simulation is a tedious alternative, I declared a variable having
| type LSODE_options name opts, and I issued the following instructions.
| LSODE ode (....)
| opts.set_step_limit(500000);
| ode.copy(opts);
| ...START simulation
| The problem, however hasn't been solved and the solvers still blocks the
| simulation complaining to overcaome the maximum number of step.

There were some mistakes in implementing this.  You can try the
following patch.  If you want it to work from the interpreter, you
will also need to have the fix I posted a few days ago.  Sorry about
forgetting this part of it then...

jwe

Fri Apr 23 11:52:23 1999  John W. Eaton  <address@hidden>

        * LSODE.cc (LSODE::do_integrate (double)): Don't forget to set
        iopt when there are optional inputs in rwork or iwork.

        * LSODE.h (LSODE_options::copy): Don't forget to copy step limit too.


*** octave-2.0.14/liboctave/LSODE.cc    Thu Oct  8 22:27:32 1998
--- liboctave/LSODE.cc  Fri Apr 23 12:22:29 1999
***************
*** 218,229 ****
        sanity_checked = 1;
      }
  
!   iwork.elem (5) = step_limit ();
  
    if (stop_time_set)
      {
        itask = 4;
        rwork.elem (0) = stop_time;
      }
    else
      {
--- 218,234 ----
        sanity_checked = 1;
      }
  
!   if (step_limit () > 0)
!     {
!       iwork.elem (5) = step_limit ();
!       iopt = 1;
!     }
  
    if (stop_time_set)
      {
        itask = 4;
        rwork.elem (0) = stop_time;
+       iopt = 1;
      }
    else
      {
***************
*** 233,241 ****
    double abs_tol = absolute_tolerance ();
    double rel_tol = relative_tolerance ();
  
!   rwork.elem (4) = (initial_step_size () >= 0.0) ? initial_step_size () : 0.0;
!   rwork.elem (5) = (maximum_step_size () >= 0.0) ? maximum_step_size () : 0.0;
!   rwork.elem (6) = (minimum_step_size () >= 0.0) ? minimum_step_size () : 0.0;
  
    int *piwork = iwork.fortran_vec ();
    double *prwork = rwork.fortran_vec ();
--- 238,260 ----
    double abs_tol = absolute_tolerance ();
    double rel_tol = relative_tolerance ();
  
!   if (initial_step_size () >= 0.0)
!     {
!       rwork.elem (4) = initial_step_size ();
!       iopt = 1;
!     }
! 
!   if (maximum_step_size () >= 0.0)
!     {
!       rwork.elem (5) = maximum_step_size ();
!       iopt = 1;
!     }
! 
!   if (minimum_step_size () >= 0.0)
!     {
!       rwork.elem (6) = minimum_step_size ();
!       iopt = 1;
!     }
  
    int *piwork = iwork.fortran_vec ();
    double *prwork = rwork.fortran_vec ();
*** octave-2.0.14/liboctave/LSODE.h     Thu Oct  8 22:27:44 1998
--- liboctave/LSODE.h   Fri Apr 23 11:52:48 1999
***************
*** 78,83 ****
--- 78,85 ----
        x_maximum_step_size = opt.x_maximum_step_size;
        x_minimum_step_size = opt.x_minimum_step_size;
        x_relative_tolerance = opt.x_relative_tolerance;
+ 
+       x_step_limit = opt.x_step_limit;
      }
  
    void set_default_options (void) { init (); }
***************
*** 119,124 ****
--- 121,127 ----
    double x_maximum_step_size;
    double x_minimum_step_size;
    double x_relative_tolerance;
+ 
    int x_step_limit;
  };
  



---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

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