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 |
5307
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
5164
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
|
27 #include "sparse-base-lu.h" |
|
28 |
|
29 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> |
|
30 p_type |
|
31 sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pr (void) const |
|
32 { |
5275
|
33 octave_idx_type nr = Lfact.rows (); |
5164
|
34 |
|
35 p_type Pout (nr, nr, nr); |
|
36 |
5275
|
37 for (octave_idx_type i = 0; i < nr; i++) |
5164
|
38 { |
|
39 Pout.cidx (i) = i; |
|
40 Pout.ridx (P (i)) = i; |
|
41 Pout.data (i) = 1; |
|
42 } |
|
43 Pout.cidx (nr) = nr; |
|
44 |
|
45 return Pout; |
|
46 } |
|
47 |
|
48 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> |
|
49 p_type |
|
50 sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pc (void) const |
|
51 { |
5275
|
52 octave_idx_type nc = Ufact.cols (); |
5164
|
53 |
|
54 p_type Pout (nc, nc, nc); |
|
55 |
5275
|
56 for (octave_idx_type i = 0; i < nc; i++) |
5164
|
57 { |
|
58 Pout.cidx (i) = i; |
|
59 Pout.ridx (i) = Q (i); |
|
60 Pout.data (i) = 1; |
|
61 } |
|
62 Pout.cidx (nc) = nc; |
|
63 |
|
64 return Pout; |
|
65 } |
|
66 |
|
67 /* |
|
68 ;;; Local Variables: *** |
|
69 ;;; mode: C++ *** |
|
70 ;;; End: *** |
|
71 */ |