Mercurial > octave
annotate liboctave/numeric/sparse-chol.h @ 22323:bac0d6f07a3e
maint: Update copyright notices for 2016.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 17 Aug 2016 01:05:19 -0400 |
parents | 6ca3acf5fad8 |
children | 7f3c7a8bd131 |
rev | line source |
---|---|
5506 | 1 /* |
2 | |
21177
a10f60e13243
style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents:
21145
diff
changeset
|
3 Copyright (C) 2016 John W. Eaton |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22317
diff
changeset
|
4 Copyright (C) 2005-2016 David Bateman |
11523 | 5 Copyright (C) 1998-2005 Andy Adler |
7016 | 6 |
7 This file is part of Octave. | |
5506 | 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. | |
5506 | 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/>. | |
5506 | 22 |
23 */ | |
24 | |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
25 #if ! defined (octave_sparse_chol_h) |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
26 #define octave_sparse_chol_h 1 |
5506 | 27 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21186
diff
changeset
|
28 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21186
diff
changeset
|
29 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
30 #include "CSparse.h" |
22229
22c2bd440544
chol: return permutation vector as row vector instead of column vector.
Carnë Draug <carandraug@octave.org>
parents:
21244
diff
changeset
|
31 #include "dRowVector.h" |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
32 #include "dSparse.h" |
5512 | 33 |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
34 namespace octave |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
35 { |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
36 namespace math |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
37 { |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
38 |
21177
a10f60e13243
style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents:
21145
diff
changeset
|
39 // If the sparse matrix classes become templated on the element type |
a10f60e13243
style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents:
21145
diff
changeset
|
40 // (i.e., sparse_matrix<double>), then it might be best to make the |
a10f60e13243
style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents:
21145
diff
changeset
|
41 // template parameter of this class also be the element type instead |
a10f60e13243
style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents:
21145
diff
changeset
|
42 // of the matrix type. |
a10f60e13243
style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents:
21145
diff
changeset
|
43 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
44 template <typename chol_type> |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
45 class |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
46 sparse_chol |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
47 { |
5506 | 48 public: |
49 | |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
50 sparse_chol (void); |
5506 | 51 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
52 sparse_chol (const chol_type& a, bool natural, bool force); |
5506 | 53 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
54 sparse_chol (const chol_type& a, octave_idx_type& info, |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
55 bool natural, bool force); |
5506 | 56 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
57 sparse_chol (const chol_type& a, octave_idx_type& info, bool natural); |
5506 | 58 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
59 sparse_chol (const chol_type& a, octave_idx_type& info); |
5506 | 60 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
61 sparse_chol (const sparse_chol<chol_type>& a); |
5506 | 62 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
63 virtual ~sparse_chol (void); |
5506 | 64 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
65 sparse_chol& operator = (const sparse_chol& a); |
5506 | 66 |
67 chol_type L (void) const; | |
68 | |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
69 chol_type R (void) const { return L ().hermitian (); } |
5506 | 70 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
71 octave_idx_type P (void) const; |
5506 | 72 |
22229
22c2bd440544
chol: return permutation vector as row vector instead of column vector.
Carnë Draug <carandraug@octave.org>
parents:
21244
diff
changeset
|
73 RowVector perm (void) const; |
5506 | 74 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
75 SparseMatrix Q (void) const; |
5506 | 76 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
77 bool is_positive_definite (void) const; |
5506 | 78 |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
79 double rcond (void) const; |
5506 | 80 |
81 chol_type inverse (void) const; | |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
82 |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
83 protected: |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
84 |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
85 typedef typename chol_type::element_type chol_elt; |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
86 |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
87 class sparse_chol_rep; |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
88 |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
89 private: |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
90 |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
91 sparse_chol_rep *rep; |
5506 | 92 }; |
93 | |
21145
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
94 template <typename chol_type> |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
95 chol_type |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
96 chol2inv (const chol_type& r); |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
97 |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
98 // SparseComplexMatrix specialization. |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
99 |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
100 template <> |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
101 sparse_chol<SparseComplexMatrix>::sparse_chol (const SparseComplexMatrix& a, |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
102 octave_idx_type& info); |
307096fb67e1
revamp sparse Cholesky factorization classes
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
103 |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
104 } |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
105 } |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22229
diff
changeset
|
106 |
5506 | 107 #endif |