Mercurial > octave
annotate liboctave/numeric/base-de.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 | 796f54d4ddbf |
children | 597f3ee61a48 |
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:
30067
diff
changeset
|
3 // Copyright (C) 1996-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 //////////////////////////////////////////////////////////////////////// |
1843 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20229
diff
changeset
|
26 #if ! defined (octave_base_de_h) |
1843 | 27 #define octave_base_de_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 |
3995 | 31 #include <string> |
32 | |
1843 | 33 #include "dColVector.h" |
34 | |
1879 | 35 class |
36 base_diff_eqn | |
1843 | 37 { |
38 public: | |
39 | |
3995 | 40 base_diff_eqn (void) |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
41 : m_x (), m_t (0.0), m_stop_time (0.0), m_stop_time_set (false), |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
42 m_restart (true), m_integration_error (false), m_istate (0) { } |
1843 | 43 |
3995 | 44 base_diff_eqn (const ColumnVector& xx, double tt) |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
45 : m_x (xx), m_t (tt), m_stop_time (0.0), m_stop_time_set (false), |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
46 m_restart (true), m_integration_error (false), m_istate (0) { } |
1843 | 47 |
3995 | 48 base_diff_eqn (const base_diff_eqn& a) |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
49 : m_x (a.m_x), m_t (a.m_t), m_stop_time (0.0), m_stop_time_set (false), |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
50 m_restart (true), m_integration_error (false), m_istate (0) { } |
1843 | 51 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
52 virtual ~base_diff_eqn (void) = default; |
1843 | 53 |
54 base_diff_eqn& operator = (const base_diff_eqn& a) | |
17769
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 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 { |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
58 m_x = a.m_x; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
59 m_t = a.m_t; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
60 m_stop_time = a.m_stop_time; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
61 m_stop_time_set = a.m_stop_time_set; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
62 m_restart = a.m_restart; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
63 m_integration_error = a.m_integration_error; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
64 m_istate = a.m_istate; |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 } |
3995 | 66 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 } |
1843 | 69 |
3984 | 70 void initialize (const ColumnVector& x0, double t0) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 { |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
72 m_x = x0; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
73 m_t = t0; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
74 m_integration_error = false; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
75 m_istate = 0; |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 force_restart (); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 } |
1843 | 78 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
79 octave_idx_type size (void) const { return m_x.numel (); } |
1843 | 80 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
81 ColumnVector state (void) const { return m_x; } |
1843 | 82 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
83 double time (void) const { return m_t; } |
1843 | 84 |
4277 | 85 void set_stop_time (double tt) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 { |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
87 m_stop_time_set = true; |
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
88 m_stop_time = tt; |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
89 force_restart (); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 } |
3995 | 91 |
4049 | 92 void clear_stop_time (void) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 { |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
94 m_stop_time_set = false; |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
95 force_restart (); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
96 } |
3995 | 97 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
98 virtual void force_restart (void) { m_restart = true; } |
3995 | 99 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
100 bool integration_ok (void) const { return ! m_integration_error; } |
3995 | 101 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
102 octave_idx_type integration_state (void) const { return m_istate; } |
3997 | 103 |
3995 | 104 virtual std::string error_message (void) const = 0; |
105 | |
1843 | 106 protected: |
107 | |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
108 ColumnVector m_x; |
3995 | 109 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
110 double m_t; |
3995 | 111 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
112 double m_stop_time; |
3995 | 113 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
114 bool m_stop_time_set; |
3995 | 115 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
116 bool m_restart; |
3995 | 117 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
118 bool m_integration_error; |
3997 | 119 |
30067
fc509c3c445a
maint: use "m_" prefix for member variables in base-de.h and base-dae.h
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
120 octave_idx_type m_istate; |
1843 | 121 }; |
122 | |
123 #endif |