comparison liboctave/numeric/lu.h @ 21271:7e67c7f82fc1

better use of templates for lu factorization classes * liboctave/numeric/lu.h, liboctave/numeric/lu.cc: New files generated from base-lu.h, base-lu.cc, CmplxLU.cc, CmplxLU.h, dbleLU.cc, dbleLU.h, fCmplxLU.cc, fCmplxLU.h, floatLU.cc, and floatLU.h and converted to templates. * liboctave/numeric/module.mk: Update. * lu.cc, mx-defs.h, mx-ext.h, eigs-base.cc: Use new classes.
author John W. Eaton <jwe@octave.org>
date Tue, 16 Feb 2016 12:58:32 -0500
parents liboctave/numeric/base-lu.h@1473547f50f5
children 6ca3acf5fad8
comparison
equal deleted inserted replaced
21270:230e186e292d 21271:7e67c7f82fc1
1 /*
2
3 Copyright (C) 1996-2015 John W. Eaton
4 Copyright (C) 2009 VZLU Prague
5
6 This file is part of Octave.
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
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
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
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21
22 */
23
24 #if ! defined (octave_lu_h)
25 #define octave_lu_h 1
26
27 #include "octave-config.h"
28
29 #include "PermMatrix.h"
30
31 template <typename T>
32 class
33 lu
34 {
35 public:
36
37 typedef typename T::column_vector_type VT;
38 typedef typename T::element_type ELT_T;
39
40 lu (void)
41 : a_fact (), l_fact (), ipvt () { }
42
43 lu (const T& a);
44
45 lu (const lu& a)
46 : a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { }
47
48 lu (const T& l, const T& u, const PermMatrix& p);
49
50 lu& operator = (const lu& a)
51 {
52 if (this != &a)
53 {
54 a_fact = a.a_fact;
55 l_fact = a.l_fact;
56 ipvt = a.ipvt;
57 }
58
59 return *this;
60 }
61
62 virtual ~lu (void) { }
63
64 bool packed (void) const;
65
66 void unpack (void);
67
68 T L (void) const;
69
70 T U (void) const;
71
72 T Y (void) const;
73
74 PermMatrix P (void) const;
75
76 ColumnVector P_vec (void) const;
77
78 bool regular (void) const;
79
80 void update (const VT& u, const VT& v);
81
82 void update (const T& u, const T& v);
83
84 void update_piv (const VT& u, const VT& v);
85
86 void update_piv (const T& u, const T& v);
87
88 protected:
89
90 Array<octave_idx_type> getp (void) const;
91
92 T a_fact;
93 T l_fact;
94
95 Array<octave_idx_type> ipvt;
96 };
97
98 #endif