bugGNU Octave - Bugs: bug #31626, lsode: patch to make Jacobian...


bug #31626: lsode: patch to make Jacobian types of dlsode.f accessible

Submitted by:  Olaf Till <i7tiol>
Submitted on:  Fri 12 Nov 2010 08:11:41 AM UTC  
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Patch Submitted Assigned to:  None
Originator Name:  Olaf Till Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 25 Feb 2021 05:39:40 PM UTC, comment #5: 

Sorry, this is taking more than 9 years now.

I applied the last version by Nick of the patch (it still applies) and compiled with the changes.

I'm not sure if I understand the intention correctly. But I think some initialization values for the newly added properties are missing from the perl generated header LSODE-opts.h:

  void init (void)
      x_absolute_tolerance.resize (dim_vector (1, 1));
      x_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilon ());
      x_relative_tolerance = ::sqrt (std::numeric_limits<double>::epsilon ());
      x_integration_method = "stiff";
      x_initial_step_size = -1.0;
      x_maximum_order = -1;
      x_maximum_step_size = -1.0;
      x_minimum_step_size = 0.0;
      x_step_limit = 100000;
      x_jacobian_type = "full";
      reset = true;

IIUC, this should include initial values (0) for x_lower_jacobian_subdiagonals and x_upper_jacobian_subdiagonals.

I think the respective section in the perl script is this:

      if ($INIT_VALUE[$i])
          print "      $OPTVAR[$i] = $INIT_VALUE[$i];\n";

If I interpret that correctly, printing the lines with the default values might be skipped because they are 0?

I can't read or write perl. So that's over my head.

Attached is a patch with just some minor updates of the formatting of the docstring.

(file #50920)

Markus M├╝tzel <mmuetzel>
Project Member
Tue 10 Mar 2020 07:24:31 PM UTC, comment #4: 

browsing old bugs, this old patch wouldn't apply because of changing octave_idx_type to F77_INT.  a couple replacements nad line shifts and the patch now applies cleanly. updated patch attached.

(file #48576)

Nicholas Jankowski <nrjank>
Project Member
Wed 06 Sep 2017 06:08:15 AM UTC, comment #3: 

Not 2, but 7 years. Before updating the patch, I'd need an indication that the patch, once properly tidied up, will actually be allowed to be applied.

Olaf Till <i7tiol>
Project Member
Tue 05 Sep 2017 08:17:31 PM UTC, comment #2: 

After almost 2 years of waiting, the patch can't be applied.
Can someone make a new patch?

Avinoam Kalma <avinoam>
Project Member
Sat 28 Nov 2015 09:03:30 AM UTC, comment #1: 

This patch seems mildly useful and straightforward.

I've updated this patch to apply cleanly to the current Mercurial repository.

I recommend that it either be applied, or its priority be reduced.

(file #35584)

Lachlan Andrew <lachlan>
Fri 12 Nov 2010 08:11:41 AM UTC, original submission:  

With the BDF method, dlsode.f is able to approximate only a diagonal or banded Jacobian (Method flag: 23, 25) and to use only a banded part of a user supplied Jacobian (Method flag: 24). This is useful for efficiency. But as yet lsode offers no interface to this. The attached patch changes this.

1. In liboctave/LSODE-opts.in, options "jacobian type" (values: "full" (default), "banded", "diagonal"), "lower jacobian subdiagonals", and "upper jacobian subdiagonals" (for use with a "jacobian type" of "banded") are introduced.

2. In liboctave/LSODE.cc, the corresponding values of method_flag are set and iwork(0) and iwork(1) are set to "lower jacobian subdiagonals" and "upper jacobian subdiagonals", respectively. Since except for method_flag == 24 the user-supplied Jacobian must (according to dlsode.f) ignore the arguments "lower jacobian subdiagonals" (ML) and "upper jacobian subdiagonals" (MU), a new file-scope variable tells lsode_j when to ignore them. With method_flag == 24, lsode_j fills only the required subdiagonals of the user-supplied Jacobian into the allocated memory as specified by dlsode.f.

I think the actual user-programmed Jacobian function need not be passed ML and MU (this would necessitate much more changes), since the user knows which "lower jacobian subdiagonals" and "upper jacobian subdiagonals" he sets for lsode and can provide these to his Jacobian-function himself, if desired.

For testing the new features and seeing the time-savings, a function 'odetest' returning a structure with two test-problems and a script 'odetest_script' which uses this function are also attached.

Note: It may be necessary to fix bug #31623 before testing (I had to do it for me), for 'lsode' to be able to see settings changed with 'lsode_options'. I'm not sure whether bug #31623 affects every system.

Olaf Till <i7tiol>
Project Member


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

Attach Files:

Attached Files
file #48576:  bug31626patchupdate.diff added by nrjank (6KiB - application/octet-stream - updated patch)
file #35584:  patch_31626.txt added by lachlan (6KiB - text/plain - Updated to current (2015-11-28) mercurial version)
file #21986:  lsode-jacobian-types.changeset added by i7tiol (6KiB - application/octet-stream)
file #21987:  odetest.m added by i7tiol (3KiB - text/x-objcsrc)
file #21988:  odetest_script.m added by i7tiol (3KiB - text/x-objcsrc)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by lachlan (Updated the item)
  • -email is unavailable- added by i7tiol (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-25 mmuetzel Attached File- => Added bug31626_lsode-jacobian-types_v4.patch, #50920
        Operating SystemGNU/Linux => Any
    2020-03-10 nrjank Attached File- => Added bug31626patchupdate.diff, #48576
    2015-11-28 lachlan Attached File- => Added patch_31626.txt, #35584
    2011-08-04 rik5 Carbon-CopyRemoved 72865 => -
    2011-08-04 rik5 StatusNone => Patch Submitted
    2010-11-12 i7tiol Attached File- => Added lsode-jacobian-types.changeset, #21986
        Attached File- => Added odetest.m, #21987
        Attached File- => Added odetest_script.m, #21988

    Back to the top

    Powered by Savane 3.7