Mercurial > hg > octave-lyh
annotate liboctave/dbleCHOL.h @ 10396:a0b51ac0f88a
optimize accumdim with summation
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 05 Mar 2010 12:31:30 +0100 |
parents | cbc402e64d83 |
children | 367bfee35ba0 |
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 | |
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) |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
51 { |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
52 chol_mat = a.chol_mat; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
53 xrcond = a.xrcond; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
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 |
8547
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7700
diff
changeset
|
67 void update (const ColumnVector& u); |
7554
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
68 |
8547
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7700
diff
changeset
|
69 octave_idx_type downdate (const ColumnVector& u); |
7554
40574114c514
implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
70 |
8547
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7700
diff
changeset
|
71 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
|
72 |
efccca5f2ad7
more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7554
diff
changeset
|
73 void delete_sym (octave_idx_type j); |
efccca5f2ad7
more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7554
diff
changeset
|
74 |
efccca5f2ad7
more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7554
diff
changeset
|
75 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
|
76 |
6108 | 77 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const CHOL& a); |
457 | 78 |
79 private: | |
80 | |
1881 | 81 Matrix chol_mat; |
457 | 82 |
6486 | 83 double xrcond; |
84 | |
85 octave_idx_type init (const Matrix& a, bool calc_cond); | |
457 | 86 }; |
87 | |
6108 | 88 Matrix OCTAVE_API chol2inv (const Matrix& r); |
5340 | 89 |
457 | 90 #endif |