annotate liboctave/numeric/ODEFunc.h @ 31249:de6fc38c78c6

Make Jacobian types offered by dlsode.f accessible by lsode (bug #31626). * liboctave/numeric/LSODE-opts.in: Add options "jacobian type", "lower jacobian subdiagonals", and "upper jacobian subdiagonals". * liboctave/numeric/LSODE.cc (file scope, lsode_j, LSODE::do_integrate (double)): Handle new configurable Jacobian types. * build-aux/mk-opts.pl: Don't implicitly convert to integer in condition.
author Olaf Till <olaf.till@uni-jena.de>
date Fri, 12 Nov 2010 08:53:05 +0100
parents 51a3d3a69193
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30508
diff changeset
3 // Copyright (C) 1993-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #if ! defined (octave_ODEFunc_h)
382
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 238
diff changeset
27 #define octave_ODEFunc_h 1
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 238
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
30
30508
6f07492c9c20 Provide header file with forward declarations of matrix types (bug #59820).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30047
diff changeset
31 #include "mx-fwd.h"
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
32
1861
620a65533630 [project @ 1996-02-04 10:17:34 by jwe]
jwe
parents: 1844
diff changeset
33 class
620a65533630 [project @ 1996-02-04 10:17:34 by jwe]
jwe
parents: 1844
diff changeset
34 ODEFunc
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
35 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
36 public:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
37
1536
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
38 typedef ColumnVector (*ODERHSFunc) (const ColumnVector&, double);
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
39 typedef Matrix (*ODEJacFunc) (const ColumnVector&, double);
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
40
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
41 ODEFunc (void)
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
42 : m_fcn (nullptr), m_jac (nullptr), m_reset (true) { }
532
2ca256b77602 [project @ 1994-07-20 19:56:55 by jwe]
jwe
parents: 465
diff changeset
43
1536
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
44 ODEFunc (ODERHSFunc f)
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
45 : m_fcn (f), m_jac (nullptr), m_reset (true) { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
46
1536
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
47 ODEFunc (ODERHSFunc f, ODEJacFunc j)
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
48 : m_fcn (f), m_jac (j), m_reset (true) { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
49
1536
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
50 ODEFunc (const ODEFunc& a)
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
51 : m_fcn (a.m_fcn), m_jac (a.m_jac), m_reset (true) { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
52
1536
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
53 ODEFunc& operator = (const ODEFunc& a)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
54 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
55 if (this != &a)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
56 {
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
57 m_fcn = a.m_fcn;
30047
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
58 m_jac = a.m_jac;
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
59 m_reset = a.m_reset;
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
60 }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
61 return *this;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
62 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
63
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
64 virtual ~ODEFunc (void) = default;
1861
620a65533630 [project @ 1996-02-04 10:17:34 by jwe]
jwe
parents: 1844
diff changeset
65
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
66 ODERHSFunc function (void) const { return m_fcn; }
1536
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
67
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
68 ODEFunc& set_function (ODERHSFunc f)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
69 {
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
70 m_fcn = f;
30047
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
71 m_reset = true;
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
72 return *this;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
73 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
74
30047
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
75 ODEJacFunc jacobian_function (void) const { return m_jac; }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
76
1536
26411f9c7603 [project @ 1995-10-05 05:41:26 by jwe]
jwe
parents: 1315
diff changeset
77 ODEFunc& set_jacobian_function (ODEJacFunc j)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
78 {
30047
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
79 m_jac = j;
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
80 m_reset = true;
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
81 return *this;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
82 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
83
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
84 protected:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
85
30898
51a3d3a69193 maint: Use "fcn" as preferred abbreviation for "function" in liboctave/.
Rik <rik@octave.org>
parents: 30564
diff changeset
86 ODERHSFunc m_fcn;
30047
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
87 ODEJacFunc m_jac;
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 2847
diff changeset
88
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 2847
diff changeset
89 // This variable is TRUE when this object is constructed, and also
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 2847
diff changeset
90 // after any internal data has changed. Derived classes may use
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 2847
diff changeset
91 // this information (and change it) to know when to (re)initialize
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 2847
diff changeset
92 // their own internal data related to this object.
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 2847
diff changeset
93
30047
02e28f7e4d04 maint: use "m_" prefix for member variables DAERTFunc/ODEFunc classes in liboctave/numeric.
Rik <rik@octave.org>
parents: 29358
diff changeset
94 bool m_reset;
382
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 238
diff changeset
95 };
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
96
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
97 #endif