annotate liboctave/numeric/ODE.h @ 33658:b1d6e40ac737 stable tip

NEWS.9.md: Fix typo and minor formatting changes. * etc/NEWS.9.md: Fix typo. Adjust whitespace. Use markdown syntax for code snippets.
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 05 Jun 2024 11:27:35 +0200
parents 2e484f9f1f18
children 4b601ca024d5
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 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
3 // Copyright (C) 1993-2024 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_ODE_h)
382
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 296
diff changeset
27 #define octave_ODE_h 1
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 296
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
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
31 #include "ODEFunc.h"
1842
0574a1f3a273 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents: 1359
diff changeset
32 #include "base-de.h"
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
33 #include "dMatrix.h"
289
c23f50e61c58 [project @ 1994-01-13 06:25:58 by jwe]
jwe
parents: 258
diff changeset
34
1861
620a65533630 [project @ 1996-02-04 10:17:34 by jwe]
jwe
parents: 1842
diff changeset
35 class
620a65533630 [project @ 1996-02-04 10:17:34 by jwe]
jwe
parents: 1842
diff changeset
36 ODE : public base_diff_eqn, public ODEFunc
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
37 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
38 public:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
39
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
40 ODE ()
1842
0574a1f3a273 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents: 1359
diff changeset
41 : base_diff_eqn (), ODEFunc () { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
42
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 3984
diff changeset
43 ODE (const ColumnVector& s, double tm, const ODEFunc& f)
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 3984
diff changeset
44 : base_diff_eqn (s, tm), ODEFunc (f) { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
45
1842
0574a1f3a273 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents: 1359
diff changeset
46 ODE (const ODE& a)
0574a1f3a273 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents: 1359
diff changeset
47 : base_diff_eqn (a), ODEFunc (a) { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
48
1842
0574a1f3a273 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents: 1359
diff changeset
49 ODE& operator = (const ODE& a)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
50 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
51 if (this != &a)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
52 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
53 base_diff_eqn::operator = (a);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
54 ODEFunc::operator = (a);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
55 }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
56 return *this;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
57 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
58
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
59 virtual ~ODE () = default;
3984
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
60
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
61 // Derived classes must provide functions to actually do the
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
62 // integration.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
63
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
64 // Return the vector of states at output time t.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
65 virtual ColumnVector do_integrate (double tt) = 0;
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
66
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
67 // Return a matrix of states at each output time specified by t.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
68 // The rows of the result matrix should each correspond to a new
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
69 // output time.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
70 virtual Matrix do_integrate (const ColumnVector& tt) = 0;
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
71
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
72 virtual Matrix do_integrate (const ColumnVector& tt,
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
73 const ColumnVector& ttcrit) = 0;
3984
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
74
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
75 // Lots of ways to call the single function and optionally set and
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
76 // get additional information.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
77
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
78 // Integrate to t from current point.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
79 virtual ColumnVector integrate (double tt)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
80 { return do_integrate (tt); }
3984
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
81
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
82 // Set new x0, t0 and integrate to t.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
83 virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
84 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
85 initialize (x0, t0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
86 return do_integrate (tt);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
87 }
3984
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
88
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
89 // Integrate from current point and return output at all points
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
90 // specified by t.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
91 virtual Matrix integrate (const ColumnVector& tt)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
92 { return do_integrate (tt); }
3984
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
93
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
94 // Set new x0, t0 and integrate to return output at all points
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
95 // specified by t.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
96 virtual Matrix integrate (const ColumnVector& x0, double t0,
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
97 const ColumnVector& tt)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
98 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
99 initialize (x0, t0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
100 return do_integrate (tt);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
101 }
3984
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
102
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
103 // Integrate from current point and return output at all points
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
104 // specified by t.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
105 virtual Matrix integrate (const ColumnVector& tt,
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
106 const ColumnVector& ttcrit)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
107 { return do_integrate (tt, ttcrit); }
3984
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
108
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
109 // Set new x0, t0 and integrate to return output at all points
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
110 // specified by t.
addebffd4961 [project @ 2002-07-11 03:39:33 by jwe]
jwe
parents: 2847
diff changeset
111 virtual Matrix integrate (const ColumnVector& x0, double t0,
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
112 const ColumnVector& tt,
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
113 const ColumnVector& ttcrit)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
114 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
115 initialize (x0, t0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
116 return do_integrate (tt, ttcrit);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
117 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
118 };
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
119
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
120 #endif