Mercurial > octave
annotate liboctave/numeric/lu.h @ 22317:6ca3acf5fad8
move some new numeric classes to namespace octave::math
* aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc,
gepbalance.h, hess.cc, hess.h, lu.cc, lu.h, qr.cc, qr.h, qrp.cc,
qrp.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h,
sparse-dmsolve.cc,sparse-lu.cc, sparse-lu.h, sparse-qr.cc,
sparse-qr.h, svd.cc, svd.h: Move classes to namespace octave::math.
* __luinc__.cc, __qp__.cc, balance.cc, hess.cc, lu.cc, qz.cc,
schur.cc, sqrtm.cc, svd.cc, chol.cc, dmperm.cc, qr.cc, lex.h,
CMatrix.cc, CSparse.cc, dMatrix.cc, dSparse.cc, fCMatrix.cc,
fMatrix.cc, eigs-base.cc, oct-norm.cc: Update for new namespaces.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 16 Aug 2016 15:48:22 -0400 |
parents | 7e67c7f82fc1 |
children | bac0d6f07a3e |
rev | line source |
---|---|
1991 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
4 Copyright (C) 2009 VZLU Prague |
1991 | 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. | |
1991 | 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/>. | |
1991 | 21 |
22 */ | |
23 | |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
24 #if ! defined (octave_lu_h) |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
25 #define octave_lu_h 1 |
1991 | 26 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
27 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
28 |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7515
diff
changeset
|
29 #include "PermMatrix.h" |
1991 | 30 |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
31 namespace octave |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
32 { |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
33 namespace math |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
34 { |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
35 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
36 template <typename T> |
3585 | 37 class |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 lu |
1991 | 39 { |
40 public: | |
41 | |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
42 typedef typename T::column_vector_type VT; |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
43 typedef typename T::element_type ELT_T; |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7515
diff
changeset
|
44 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
45 lu (void) |
11505
9a308e96194e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10521
diff
changeset
|
46 : a_fact (), l_fact (), ipvt () { } |
1991 | 47 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
48 lu (const T& a); |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
49 |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
50 lu (const lu& a) |
11505
9a308e96194e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10521
diff
changeset
|
51 : a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { } |
9694
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
52 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
53 lu (const T& l, const T& u, const PermMatrix& p); |
1991 | 54 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
55 lu& operator = (const lu& a) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
58 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
59 a_fact = a.a_fact; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
60 l_fact = a.l_fact; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 ipvt = a.ipvt; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 } |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
63 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 } |
1991 | 66 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
67 virtual ~lu (void) { } |
1991 | 68 |
9694
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
69 bool packed (void) const; |
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
70 |
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
71 void unpack (void); |
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
72 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
73 T L (void) const; |
1991 | 74 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
75 T U (void) const; |
1991 | 76 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
77 T Y (void) const; |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
78 |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7515
diff
changeset
|
79 PermMatrix P (void) const; |
1991 | 80 |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
81 ColumnVector P_vec (void) const; |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
82 |
9715
9f27172fbd1e
auto-set MatrixType from certain functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9694
diff
changeset
|
83 bool regular (void) const; |
9f27172fbd1e
auto-set MatrixType from certain functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9694
diff
changeset
|
84 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
85 void update (const VT& u, const VT& v); |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
86 |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
87 void update (const T& u, const T& v); |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
88 |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
89 void update_piv (const VT& u, const VT& v); |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
90 |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
91 void update_piv (const T& u, const T& v); |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
92 |
1991 | 93 protected: |
94 | |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7515
diff
changeset
|
95 Array<octave_idx_type> getp (void) const; |
11505
9a308e96194e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10521
diff
changeset
|
96 |
21271
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
97 T a_fact; |
7e67c7f82fc1
better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
98 T l_fact; |
11505
9a308e96194e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10521
diff
changeset
|
99 |
9694
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
100 Array<octave_idx_type> ipvt; |
1991 | 101 }; |
102 | |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
103 } |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
104 } |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21271
diff
changeset
|
105 |
1991 | 106 #endif |