Mercurial > hg > octave-nkf
annotate liboctave/sparse-base-lu.h @ 10804:3d5c6b84ddaf
speed-up fixes to dlmread
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 20 Jul 2010 12:50:54 +0200 |
parents | cbc402e64d83 |
children | 9a308e96194e |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
8920 | 3 Copyright (C) 2004, 2005, 2007, 2008 David Bateman |
7016 | 4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
5 | |
6 This file is part of Octave. | |
5164 | 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. | |
5164 | 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/>. | |
5164 | 21 |
22 */ | |
23 | |
24 | |
25 #if !defined (octave_sparse_base_lu_h) | |
26 #define octave_sparse_base_lu_h 1 | |
27 | |
28 #include "MArray.h" | |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
29 #include "dSparse.h" |
5164 | 30 |
31 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> | |
32 class | |
33 sparse_base_lu | |
34 { | |
35 public: | |
36 | |
37 sparse_base_lu (void) { } | |
38 | |
39 sparse_base_lu (const sparse_base_lu& a) | |
40 : Lfact (a.Lfact), Ufact (a.Ufact), cond (a.cond), P (a.P), Q (a.Q) { } | |
41 | |
42 sparse_base_lu& operator = (const sparse_base_lu& a) | |
43 { | |
44 if (this != &a) | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
45 { |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
46 Lfact = a.Lfact; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
47 Ufact = a.Ufact; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
48 cond = a.cond; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
49 P = a.P; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
50 Q = a.Q; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
51 } |
5164 | 52 return *this; |
53 } | |
54 | |
55 ~sparse_base_lu (void) { } | |
56 | |
57 lu_type L (void) const { return Lfact; } | |
58 | |
59 lu_type U (void) const { return Ufact; } | |
60 | |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
61 SparseMatrix R (void) const { return Rfact; } |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
62 |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
63 lu_type Y (void) const; |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
64 |
5164 | 65 p_type Pc (void) const; |
66 | |
67 p_type Pr (void) const; | |
68 | |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
69 ColumnVector Pc_vec (void) const; |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
70 |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
71 ColumnVector Pr_vec (void) const; |
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
72 |
8969
3ecbc236e2e0
Have sparse LU return permutation matrices rather than sparse matrices.
Jason Riedy <jason@acm.org>
parents:
8920
diff
changeset
|
73 PermMatrix Pc_mat (void) const; |
3ecbc236e2e0
Have sparse LU return permutation matrices rather than sparse matrices.
Jason Riedy <jason@acm.org>
parents:
8920
diff
changeset
|
74 |
3ecbc236e2e0
Have sparse LU return permutation matrices rather than sparse matrices.
Jason Riedy <jason@acm.org>
parents:
8920
diff
changeset
|
75 PermMatrix Pr_mat (void) const; |
3ecbc236e2e0
Have sparse LU return permutation matrices rather than sparse matrices.
Jason Riedy <jason@acm.org>
parents:
8920
diff
changeset
|
76 |
5322 | 77 const octave_idx_type * row_perm (void) const { return P.fortran_vec (); } |
5164 | 78 |
5322 | 79 const octave_idx_type * col_perm (void) const { return Q.fortran_vec (); } |
5164 | 80 |
81 double rcond (void) const { return cond; } | |
82 | |
83 protected: | |
84 | |
85 lu_type Lfact; | |
86 lu_type Ufact; | |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
87 SparseMatrix Rfact; |
5164 | 88 |
89 double cond; | |
90 | |
5322 | 91 MArray<octave_idx_type> P; |
92 MArray<octave_idx_type> Q; | |
5164 | 93 }; |
94 | |
95 #endif |