Mercurial > octave
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 |
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 | 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 | 27 #define octave_ODE_h 1 |
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 | 31 #include "ODEFunc.h" |
1842 | 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 | 34 |
1861 | 35 class |
36 ODE : public base_diff_eqn, public ODEFunc | |
3 | 37 { |
38 public: | |
39 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
40 ODE () |
1842 | 41 : base_diff_eqn (), ODEFunc () { } |
3 | 42 |
4587 | 43 ODE (const ColumnVector& s, double tm, const ODEFunc& f) |
44 : base_diff_eqn (s, tm), ODEFunc (f) { } | |
3 | 45 |
1842 | 46 ODE (const ODE& a) |
47 : base_diff_eqn (a), ODEFunc (a) { } | |
3 | 48 |
1842 | 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 | 58 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
59 virtual ~ODE () = default; |
3984 | 60 |
61 // Derived classes must provide functions to actually do the | |
62 // integration. | |
63 | |
64 // Return the vector of states at output time t. | |
65 virtual ColumnVector do_integrate (double tt) = 0; | |
66 | |
67 // Return a matrix of states at each output time specified by t. | |
68 // The rows of the result matrix should each correspond to a new | |
69 // output time. | |
70 virtual Matrix do_integrate (const ColumnVector& tt) = 0; | |
71 | |
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 | 74 |
75 // Lots of ways to call the single function and optionally set and | |
76 // get additional information. | |
77 | |
78 // Integrate to t from current point. | |
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 | 81 |
82 // Set new x0, t0 and integrate to t. | |
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 | 88 |
89 // Integrate from current point and return output at all points | |
90 // specified by t. | |
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 | 93 |
94 // Set new x0, t0 and integrate to return output at all points | |
95 // specified by t. | |
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 | 102 |
103 // Integrate from current point and return output at all points | |
104 // specified by t. | |
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 | 108 |
109 // Set new x0, t0 and integrate to return output at all points | |
110 // specified by t. | |
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 | 118 }; |
119 | |
120 #endif |