help-octave
[Top][All Lists]
Advanced

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

Re: LSODE speed up question


From: Tatsuro MATSUOKA
Subject: Re: LSODE speed up question
Date: Sat, 26 Apr 2008 08:27:07 +0900 (JST)

Hello

--- Ayesha Kalra <address@hidden> wrote:

> Hi Tatsuro
> I can not furnish the whole code but, here is the heart of the code which
> solves the system of equations f
> 
> //*****************************************************************
> 
>  // initialize the solver by transfering the function f
> 
>          ODEFunc odef (f);
> 
>          // initialize the solver with XS and the initial time
> 
>          // as well as the ODEFunc object ode
> 
> 
> 
>          // LSODE options to be specified ***************************
> 
>          LSODE_options ();                // should specify a stiff solver
> 
> 
>          // *********************************************************
> 
> 
> 
>          LSODE ls(XS, 0.0, odef);
> 
>          // integrate
> 
>          y = ls.do_integrate(t);
> 
> 
> 
>          // append data
> 
>          X_and_S.insert(t,0,0);
> 
>          X_and_S.insert(y,0,1);
> 
> 
> 
> //*****************************************************************


The above is general code for LSODE in C++. (I have used a similar routine by 
myself.)
So the information is not so helpful for the discussion.


> The function f is a ColumnVector of length ~300. t is a ColumnVector of
> length 500. I got the idea to solve equations using LSODE in C++ from the
> following link


The step of t is not related to LSODE speed.  
LSODE automatically detemine the integration step 
if you do not specify it at lsode options.  
The vector t is used only for store integated data.
Only t(size-1) valuse is used to determine integration range.

Please read help lsode_options.
Those are to be set for the critical problem.

Perhaps the function f is a key point.  Is your problem whether the your 
problem stiff or not?
If it is not stiff, you can set lsode option to non-stiff.  
At that case no Jacobian is used.  

In addition, f is a ColumnVector of length ~300.  The function should be 
complex.



octave:2> help lsode_options
 -- Loadable Function:  lsode_options (OPT, VAL)
     When called with two arguments, this function allows you set
     options parameters for the function `lsode'.  Given one argument,
     `lsode_options' returns the value of the corresponding option.  If
     no arguments are supplied, the names of all the available options
     and their current values are displayed.

     Options include

    `"absolute tolerance"'
          Absolute tolerance.  May be either vector or scalar.  If a
          vector, it must match the dimension of the state vector.

    `"relative tolerance"'
          Relative tolerance parameter.  Unlike the absolute tolerance,
          this parameter may only be a scalar.

          The local error test applied at each integration step is

                 abs (local error in x(i)) <= ...
                     rtol * abs (y(i)) + atol(i)

    `"integration method"'
          A string specifying the method of integration to use to solve
          the ODE system.  Valid values are

         "adams"
         "non-stiff"
               No Jacobian used (even if it is available).

         "bdf"

         "stiff"
               Use stiff backward differentiation formula (BDF) method.
               If a function to compute the Jacobian is not supplied,
               `lsode' will compute a finite difference approximation
               of the Jacobian matrix.

    `"initial step size"'
          The step size to be attempted on the first step (default is
          determined automatically).

    `"maximum order"'
          Restrict the maximum order of the solution method.  If using
          the Adams method, this option must be between 1 and 12.
          Otherwise, it must be between 1 and 5, inclusive.

    `"maximum step size"'
          Setting the maximum stepsize will avoid passing over very
          large regions  (default is not specified).

    `"minimum step size"'
          The minimum absolute step size allowed (default is 0).

    `"step limit"'
          Maximum number of steps allowed (default is 100000). 


> http://info.ee.surrey.ac.uk/Personal/M.Michel/index.php?page=4&site=4
> 
> Your inputs are welcome.
> 
> Ayesha
> 
> On Fri, Apr 25, 2008 at 5:19 PM, Tatsuro MATSUOKA <address@hidden>
> wrote:
> 
> > If you would like to use Automatic Differentiation by Analytically,
> > please use symbolic package in octave-forge.
> > http://octave.sourceforge.net/packages.html
> > and see
> > http://wiki.octave.org/wiki.pl?CategorySymbolic
> >
> > If possible, please show the your C++ code.
> > That will make more fruitful discussion possible
> >
> >
> > Regards
> >
> > Tatsuro
> > --- Ayesha Kalra <address@hidden> wrote:
> >
> > > Hi all,
> > > I am using LSODE in a C++ program to solve a system of ~300 ODEs (500
> > time
> > > steps). I used LSODE in C++ so that I could get some performance
> > enhancement
> > > over using LSODE in Octave itself, however, there was no improvement in
> > > performance (measured in time (in sec) taken to solve the system of
> > > equations. It may be noted that in both cases, I am NOT supplying the
> > > Jacobian to LSODE. Can anyone tell me what is the bottleneck step for
> > LSODE,
> > > if it is calculation of Jacobian of the system,  I will try to calculate
> > it
> > > explicitly using some kind of Automatic Differentiation library and then
> > > supply it to LSODE (I am not sure, how to do this right now, any
> > > ideas/suggestions are welcome).
> > >
> > > Or, is there anything else I need to look/change to speed up solution by
> > > LSODE in C++.
> > >
> > > Thanks
> > > Ayesha
> > > > _______________________________________________
> > > Help-octave mailing list
> > > address@hidden
> > > https://www.cae.wisc.edu/mailman/listinfo/help-octave
> > >
> >
> >
> > --------------------------------------
> > GANBARE! NIPPON! Win your ticket to Olympic Games 2008.
> > http://pr.mail.yahoo.co.jp/ganbare-nippon/
> >
> 


--------------------------------------
GANBARE! NIPPON! Win your ticket to Olympic Games 2008.
http://pr.mail.yahoo.co.jp/ganbare-nippon/


reply via email to

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