5164
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 2004, 2005, 2007 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" |
|
29 |
|
30 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> |
|
31 class |
|
32 sparse_base_lu |
|
33 { |
|
34 public: |
|
35 |
|
36 sparse_base_lu (void) { } |
|
37 |
|
38 sparse_base_lu (const sparse_base_lu& a) |
|
39 : Lfact (a.Lfact), Ufact (a.Ufact), cond (a.cond), P (a.P), Q (a.Q) { } |
|
40 |
|
41 sparse_base_lu& operator = (const sparse_base_lu& a) |
|
42 { |
|
43 if (this != &a) |
|
44 { |
|
45 Lfact = a.Lfact; |
|
46 Ufact = a.Ufact; |
|
47 cond = a.cond; |
|
48 P = a.P; |
|
49 Q = a.Q; |
|
50 } |
|
51 return *this; |
|
52 } |
|
53 |
|
54 ~sparse_base_lu (void) { } |
|
55 |
|
56 lu_type L (void) const { return Lfact; } |
|
57 |
|
58 lu_type U (void) const { return Ufact; } |
|
59 |
|
60 p_type Pc (void) const; |
|
61 |
|
62 p_type Pr (void) const; |
|
63 |
5322
|
64 const octave_idx_type * row_perm (void) const { return P.fortran_vec (); } |
5164
|
65 |
5322
|
66 const octave_idx_type * col_perm (void) const { return Q.fortran_vec (); } |
5164
|
67 |
|
68 double rcond (void) const { return cond; } |
|
69 |
|
70 protected: |
|
71 |
|
72 lu_type Lfact; |
|
73 lu_type Ufact; |
|
74 |
|
75 double cond; |
|
76 |
5322
|
77 MArray<octave_idx_type> P; |
|
78 MArray<octave_idx_type> Q; |
5164
|
79 }; |
|
80 |
|
81 #endif |
|
82 |
|
83 /* |
|
84 ;;; Local Variables: *** |
|
85 ;;; mode: C++ *** |
|
86 ;;; End: *** |
|
87 */ |