GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
sparse-base-lu.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2013 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
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 
25 #if !defined (octave_sparse_base_lu_h)
26 #define octave_sparse_base_lu_h 1
27 
28 #include "MArray.h"
29 #include "dSparse.h"
30 
31 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type>
32 class
34 {
35 public:
36 
38  : Lfact (), Ufact (), Rfact (), cond (0), P (), Q () { }
39 
41  : Lfact (a.Lfact), Ufact (a.Ufact), Rfact (), cond (a.cond),
42  P (a.P), Q (a.Q)
43  { }
44 
45  sparse_base_lu& operator = (const sparse_base_lu& a)
46  {
47  if (this != &a)
48  {
49  Lfact = a.Lfact;
50  Ufact = a.Ufact;
51  cond = a.cond;
52  P = a.P;
53  Q = a.Q;
54  }
55  return *this;
56  }
57 
58  virtual ~sparse_base_lu (void) { }
59 
60  lu_type L (void) const { return Lfact; }
61 
62  lu_type U (void) const { return Ufact; }
63 
64  SparseMatrix R (void) const { return Rfact; }
65 
66  lu_type Y (void) const;
67 
68  p_type Pc (void) const;
69 
70  p_type Pr (void) const;
71 
72  ColumnVector Pc_vec (void) const;
73 
74  ColumnVector Pr_vec (void) const;
75 
76  PermMatrix Pc_mat (void) const;
77 
78  PermMatrix Pr_mat (void) const;
79 
80  const octave_idx_type * row_perm (void) const { return P.fortran_vec (); }
81 
82  const octave_idx_type * col_perm (void) const { return Q.fortran_vec (); }
83 
84  double rcond (void) const { return cond; }
85 
86 protected:
87 
88  lu_type Lfact;
89  lu_type Ufact;
91 
92  double cond;
93 
96 };
97 
98 #endif