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 #ifdef HAVE_CONFIG_H |
|
25 #include <config.h> |
|
26 #endif |
|
27 |
|
28 #include "sparse-base-lu.h" |
|
29 |
|
30 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> |
|
31 p_type |
|
32 sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pr (void) const |
|
33 { |
5275
|
34 octave_idx_type nr = Lfact.rows (); |
5164
|
35 |
|
36 p_type Pout (nr, nr, nr); |
|
37 |
5275
|
38 for (octave_idx_type i = 0; i < nr; i++) |
5164
|
39 { |
|
40 Pout.cidx (i) = i; |
|
41 Pout.ridx (P (i)) = i; |
|
42 Pout.data (i) = 1; |
|
43 } |
|
44 Pout.cidx (nr) = nr; |
|
45 |
|
46 return Pout; |
|
47 } |
|
48 |
|
49 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> |
|
50 p_type |
|
51 sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pc (void) const |
|
52 { |
5275
|
53 octave_idx_type nc = Ufact.cols (); |
5164
|
54 |
|
55 p_type Pout (nc, nc, nc); |
|
56 |
5275
|
57 for (octave_idx_type i = 0; i < nc; i++) |
5164
|
58 { |
|
59 Pout.cidx (i) = i; |
|
60 Pout.ridx (i) = Q (i); |
|
61 Pout.data (i) = 1; |
|
62 } |
|
63 Pout.cidx (nc) = nc; |
|
64 |
|
65 return Pout; |
|
66 } |
|
67 |
|
68 /* |
|
69 ;;; Local Variables: *** |
|
70 ;;; mode: C++ *** |
|
71 ;;; End: *** |
|
72 */ |