Mercurial > octave
annotate liboctave/numeric/aepbalance.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 | e88a07dec498 |
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:
30078
diff
changeset
|
3 // Copyright (C) 1994-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 //////////////////////////////////////////////////////////////////////// |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
25 |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
26 #if ! defined (octave_aepbalance_h) |
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
27 #define octave_aepbalance_h 1 |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
30 |
23442
53f5f8231c37
allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
31 #include <algorithm> |
53f5f8231c37
allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
32 |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21268
diff
changeset
|
33 namespace octave |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21268
diff
changeset
|
34 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
35 namespace math |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
36 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
37 template <typename MT> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
38 class |
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
39 aepbalance |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
40 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
41 public: |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
42 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
43 typedef typename MT::real_column_vector_type VT; |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21268
diff
changeset
|
44 |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
45 aepbalance (void) : m_balanced_mat (), m_scale (), m_ilo (), m_ihi (), m_job () { } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
46 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
47 OCTAVE_API aepbalance (const MT& a, bool noperm = false, bool noscal = false); |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
48 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
49 aepbalance (const aepbalance& a) |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
50 : m_balanced_mat (a.m_balanced_mat), m_scale (a.m_scale), |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
51 m_ilo(a.m_ilo), m_ihi(a.m_ihi), m_job(a.m_job) |
22417
48c00363dc74
maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
52 { } |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
53 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
54 aepbalance& operator = (const aepbalance& a) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
55 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
56 if (this != &a) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
57 { |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
58 m_balanced_mat = a.m_balanced_mat; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
59 m_scale = a.m_scale; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
60 m_ilo = a.m_ilo; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
61 m_ihi = a.m_ihi; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
62 m_job = a.m_job; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
63 } |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
64 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
65 return *this; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
66 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
67 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
68 virtual ~aepbalance (void) = default; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
69 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
70 OCTAVE_API MT balancing_matrix (void) const; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
71 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
72 MT balanced_matrix (void) const |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
73 { |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
74 return m_balanced_mat; |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
75 } |
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
76 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
77 VT permuting_vector (void) const |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
78 { |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
79 octave_idx_type n = m_balanced_mat.rows (); |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
80 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
81 VT pv (n); |
11505
9a308e96194e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
9821
diff
changeset
|
82 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
83 for (octave_idx_type i = 0; i < n; i++) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
84 pv(i) = i+1; |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
85 |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
86 for (octave_idx_type i = n-1; i >= m_ihi; i--) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
87 { |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
88 octave_idx_type j = m_scale(i) - 1; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
89 std::swap (pv(i), pv(j)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
90 } |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
91 |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
92 for (octave_idx_type i = 0; i < m_ilo-1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
93 { |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
94 octave_idx_type j = m_scale(i) - 1; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
95 std::swap (pv(i), pv(j)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
96 } |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
97 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
98 return pv; |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
99 } |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
100 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
101 VT scaling_vector (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
102 { |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
103 octave_idx_type n = m_balanced_mat.rows (); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
104 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
105 VT scv (n); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
106 |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
107 for (octave_idx_type i = 0; i < m_ilo-1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
108 scv(i) = 1; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
109 |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
110 for (octave_idx_type i = m_ilo-1; i < m_ihi; i++) |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
111 scv(i) = m_scale(i); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
112 |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
113 for (octave_idx_type i = m_ihi; i < n; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
114 scv(i) = 1; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
115 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
116 return scv; |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
117 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
118 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
119 protected: |
21268
f08ae27289e4
better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
120 |
30078
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
121 MT m_balanced_mat; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
122 VT m_scale; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
123 octave_idx_type m_ilo; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
124 octave_idx_type m_ihi; |
443571d367fe
maint: use "m_" prefix for member variables in class aepbalance.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
125 char m_job; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
126 }; |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 } |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21268
diff
changeset
|
128 } |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21268
diff
changeset
|
129 |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
130 #endif |