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