5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 Copyright (C) 1998-2004 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
|
17 along with this program; see the file COPYING. If not, write to the Free |
|
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
19 |
|
20 */ |
|
21 |
|
22 #ifdef HAVE_CONFIG_H |
|
23 #include <config.h> |
|
24 #endif |
|
25 |
|
26 #include "sparse-base-lu.h" |
|
27 |
|
28 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> |
|
29 p_type |
|
30 sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pr (void) const |
|
31 { |
|
32 int nr = Lfact.rows (); |
|
33 |
|
34 p_type Pout (nr, nr, nr); |
|
35 |
|
36 for (int i = 0; i < nr; i++) |
|
37 { |
|
38 Pout.cidx (i) = i; |
|
39 Pout.ridx (P (i)) = i; |
|
40 Pout.data (i) = 1; |
|
41 } |
|
42 Pout.cidx (nr) = nr; |
|
43 |
|
44 return Pout; |
|
45 } |
|
46 |
|
47 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> |
|
48 p_type |
|
49 sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pc (void) const |
|
50 { |
|
51 int nc = Ufact.cols (); |
|
52 |
|
53 p_type Pout (nc, nc, nc); |
|
54 |
|
55 for (int i = 0; i < nc; i++) |
|
56 { |
|
57 Pout.cidx (i) = i; |
|
58 Pout.ridx (i) = Q (i); |
|
59 Pout.data (i) = 1; |
|
60 } |
|
61 Pout.cidx (nc) = nc; |
|
62 |
|
63 return Pout; |
|
64 } |
|
65 |
|
66 /* |
|
67 ;;; Local Variables: *** |
|
68 ;;; mode: C++ *** |
|
69 ;;; End: *** |
|
70 */ |