Mercurial > octave
annotate liboctave/numeric/chol.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:
30032
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 //////////////////////////////////////////////////////////////////////// |
457 | 25 |
21269
3c8a3d35661a
better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
26 #if ! defined (octave_chol_h) |
3c8a3d35661a
better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
27 #define octave_chol_h 1 |
457 | 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 |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21269
diff
changeset
|
31 namespace octave |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21269
diff
changeset
|
32 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
33 namespace math |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
34 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
35 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
36 class |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
37 chol |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
38 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
39 public: |
457 | 40 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
41 typedef typename T::column_vector_type VT; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
42 typedef typename T::real_elt_type COND_T; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
43 |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
44 chol (void) : m_chol_mat (), m_rcond (0), m_is_upper (true) { } |
1528 | 45 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
46 chol (const T& a, bool upper = true, bool calc_cond = false) |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
47 : m_chol_mat (), m_rcond (0) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
48 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
49 init (a, upper, calc_cond); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
50 } |
457 | 51 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
52 chol (const T& a, octave_idx_type& info, bool upper = true, |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
53 bool calc_cond = false) |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
54 : m_chol_mat (), m_rcond (0) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
56 info = init (a, upper, calc_cond); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 } |
21269
3c8a3d35661a
better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
58 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
59 chol (const chol& a) |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
60 : m_chol_mat (a.m_chol_mat), m_rcond (a.m_rcond), m_is_upper (a.m_is_upper) { } |
1528 | 61 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
62 chol& operator = (const chol& a) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
63 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
64 if (this != &a) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
65 { |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
66 m_chol_mat = a.m_chol_mat; |
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
67 m_rcond = a.m_rcond; |
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
68 m_is_upper = a.m_is_upper; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
69 } |
6486 | 70 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
71 return *this; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
72 } |
5340 | 73 |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
74 T chol_matrix (void) const { return m_chol_mat; } |
7554
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
75 |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
76 COND_T rcond (void) const { return m_rcond; } |
7554
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
77 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
78 // Compute the inverse of a matrix using the Cholesky factorization. |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
79 OCTAVE_API T inverse (void) const; |
7554
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
80 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
81 OCTAVE_API void set (const T& R); |
7700
efccca5f2ad7
more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7554
diff
changeset
|
82 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
83 OCTAVE_API void update (const VT& u); |
7700
efccca5f2ad7
more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7554
diff
changeset
|
84 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
85 OCTAVE_API octave_idx_type downdate (const VT& u); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
86 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
87 OCTAVE_API octave_idx_type insert_sym (const VT& u, octave_idx_type j); |
7700
efccca5f2ad7
more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7554
diff
changeset
|
88 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
89 OCTAVE_API void delete_sym (octave_idx_type j); |
457 | 90 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
91 OCTAVE_API void shift_sym (octave_idx_type i, octave_idx_type j); |
457 | 92 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
93 private: |
6486 | 94 |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
95 T m_chol_mat; |
20462
5ce959c55cc0
Propagate 'lower' in chol(a, 'lower') to underlying library function.
PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
parents:
19697
diff
changeset
|
96 |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
97 COND_T m_rcond; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
98 |
30032
e156fce82e00
maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
99 bool m_is_upper; |
457 | 100 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
101 OCTAVE_API octave_idx_type init (const T& a, bool upper, bool calc_cond); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
102 }; |
5340 | 103 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
104 template <typename T> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
105 OCTAVE_API T |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
106 chol2inv (const T& r); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
107 } |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21269
diff
changeset
|
108 } |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21269
diff
changeset
|
109 |
457 | 110 #endif |