bugGNU Octave - Bugs: bug #46106, ode45: FSAL property not used,...

 
 

bug #46106: ode45: FSAL property not used, solver fail if it is activated

Submitter:  Carlo de Falco <cdf>
Submitted:  Fri 02 Oct 2015 04:27:44 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  In Progress Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 11 Oct 2015 04:53:00 PM UTC, comment #2: 

Hi,

I just pushed this changeset: http://hg.savannah.gnu.org/hgweb/octave/rev/a22d8a2eb0e5

in order to make the adaptive stepping algorithm more matlab
compatible.

As this changeset i also, as a byproduct, solving the k_vals issue, I am now closing this ticket.

BTW, It seems another by-product is a further small enhancement of performance:


Testsuite HIRES, testing solver   ode45 with relative tolerance 1e-07
-----------------------------------------------------------------------------------------
 Solver  RelTol  AbsTol   Init   Mescd    Scd  Steps  Accept  FEval  JEval  LUdec    Time
-----------------------------------------------------------------------------------------
  ode45   1e-07   1e-07   1e-09   3.72   1.30  12334   20860  86331                24.942
-----------------------------------------------------------------------------------------


Carlo de Falco <cdf>
Group Member
Sat 03 Oct 2015 05:32:19 AM UTC, comment #1: 

Hi,

I'm pushing the new attached patch (file #35045) which
seems to fix the issue of failing integration with FSAL.

The problem was that when a time step was rejected the solution
would be thrown away but not the "k_vals".

Here is a performance comparison with and without the
patch.

with patch:

Testsuite HIRES, testing solver   ode45 with relative tolerance 1e-07
-----------------------------------------------------------------------------------------
 Solver  RelTol  AbsTol   Init   Mescd    Scd  Steps  Accept  FEval  JEval  LUdec    Time
-----------------------------------------------------------------------------------------
  ode45   1e-07   1e-07   1e-09   7.24   4.82  12334   10430  86331                26.216
-----------------------------------------------------------------------------------------



without patch:

Testsuite HIRES, testing solver   ode45 with relative tolerance 1e-07
-----------------------------------------------------------------------------------------
 Solver  RelTol  AbsTol   Init   Mescd    Scd  Steps  Accept  FEval  JEval  LUdec    Time
-----------------------------------------------------------------------------------------
  ode45   1e-07   1e-07   1e-09   7.24   4.82  12334   10430  86331                30.596
-----------------------------------------------------------------------------------------



It would probably be cleaner to check for empty "k_vals"
inside the stepper rather than in the integrator, but that
would require changing other steppers that are not yet in core.

Therefore I am pushing the changeset but I'll leave the bug
open so we remember to cleanup later.


Carlo de Falco <cdf>
Group Member
Fri 02 Oct 2015 04:27:44 PM UTC, original submission:  

Hi,

Looking at the code in "runge_kutta_45_dorpri.m"
I noticed the following lines:


options = varargin{1};
  k = zeros (size (x, 1), 4);

  if (nargin == 5) # only the options are passed
    k(:,1) = feval (f, t , x, options.vfunarguments{:});
  elseif (nargin == 6) # both the options and the k values are passed
    k(:,1) = varargin{2}(:,end); # FSAL property
  endif
  k(:,1) = feval (f, t, x, options.vfunarguments{:});


It seems to me that

1) the check for nargin == 5 is ignored as options = varargin{1} is set in any case
2) if previously computed stages are passed, the FSAL property is not exploited as
   k(:, 1) is overwritten any way

the attached patch tries to fix this and avoid unnecessary fevals to improve performance but if I apply the patch the solver fails.

I suspect similar problems apply to other RK steppers that have the FSAL property.

c.

Carlo de Falco <cdf>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #35045:  open_npmRwQk8.txt added by cdf (12KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cdf (Submitted the item)
  • -email is unavailable- added by cdf
  • -email is unavailable- added by cdf
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-10-11 cdf Open/ClosedOpen Closed
    2015-10-03 cdf StatusNeed Info In Progress
    2015-10-03 cdf Attached File- Added open_npmRwQk8.txt, #35045
    2015-10-03 cdf Attached File#35036 Removed
    2015-10-02 cdf Attached File- Added open_8IkppQnp.txt, #35036
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code