Mercurial > hg > octave-lyh
annotate liboctave/dbleCHOL.h @ 7554:40574114c514
implement Cholesky factorization updating
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 04 Mar 2008 22:25:50 -0500 |
parents | a1dbe9d80eee |
children | efccca5f2ad7 |
rev | line source |
---|---|
457 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, |
4 2007 John W. Eaton | |
457 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
457 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
457 | 21 |
22 */ | |
23 | |
7554
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
24 // updating/downdating by Jaroslav Hajek 2008 |
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
25 |
457 | 26 #if !defined (octave_CHOL_h) |
27 #define octave_CHOL_h 1 | |
28 | |
3503 | 29 #include <iostream> |
457 | 30 |
31 #include "dMatrix.h" | |
32 | |
1881 | 33 class |
6108 | 34 OCTAVE_API |
1881 | 35 CHOL |
457 | 36 { |
37 public: | |
38 | |
1881 | 39 CHOL (void) : chol_mat () { } |
1528 | 40 |
6486 | 41 CHOL (const Matrix& a, bool calc_cond = false) { init (a, calc_cond); } |
457 | 42 |
6486 | 43 CHOL (const Matrix& a, octave_idx_type& info, bool calc_cond = false) |
44 { info = init (a, calc_cond); } | |
1528 | 45 |
6486 | 46 CHOL (const CHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } |
457 | 47 |
1528 | 48 CHOL& operator = (const CHOL& a) |
49 { | |
1881 | 50 if (this != &a) |
6486 | 51 { |
52 chol_mat = a.chol_mat; | |
53 xrcond = a.xrcond; | |
54 } | |
1528 | 55 return *this; |
56 } | |
57 | |
58 Matrix chol_matrix (void) const { return chol_mat; } | |
59 | |
6486 | 60 double rcond (void) const { return xrcond; } |
61 | |
5340 | 62 // Compute the inverse of a matrix using the Cholesky factorization. |
63 Matrix inverse (void) const; | |
64 | |
7554
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
65 void set (const Matrix& R); |
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
66 |
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
67 void update (const Matrix& u); |
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
68 |
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
69 octave_idx_type downdate (const Matrix& u); |
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
70 |
6108 | 71 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const CHOL& a); |
457 | 72 |
73 private: | |
74 | |
1881 | 75 Matrix chol_mat; |
457 | 76 |
6486 | 77 double xrcond; |
78 | |
79 octave_idx_type init (const Matrix& a, bool calc_cond); | |
457 | 80 }; |
81 | |
6108 | 82 Matrix OCTAVE_API chol2inv (const Matrix& r); |
5340 | 83 |
457 | 84 #endif |
85 | |
86 /* | |
87 ;;; Local Variables: *** | |
88 ;;; mode: C++ *** | |
89 ;;; End: *** | |
90 */ |