Octave-Forge - Extra packages for GNU Octave | |
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code |
00001 /* 00002 00003 Copyright (C) 2004, 2005, 2007, 2008 David Bateman 00004 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler 00005 00006 This file is part of Octave. 00007 00008 Octave is free software; you can redistribute it and/or modify it 00009 under the terms of the GNU General Public License as published by the 00010 Free Software Foundation; either version 3 of the License, or (at your 00011 option) any later version. 00012 00013 Octave is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00015 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00016 for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with Octave; see the file COPYING. If not, see 00020 <http://www.gnu.org/licenses/>. 00021 00022 */ 00023 00024 00025 #if !defined (octave_sparse_base_lu_h) 00026 #define octave_sparse_base_lu_h 1 00027 00028 #include "MArray.h" 00029 #include "dSparse.h" 00030 00031 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> 00032 class 00033 sparse_base_lu 00034 { 00035 public: 00036 00037 sparse_base_lu (void) { } 00038 00039 sparse_base_lu (const sparse_base_lu& a) 00040 : Lfact (a.Lfact), Ufact (a.Ufact), cond (a.cond), P (a.P), Q (a.Q) { } 00041 00042 sparse_base_lu& operator = (const sparse_base_lu& a) 00043 { 00044 if (this != &a) 00045 { 00046 Lfact = a.Lfact; 00047 Ufact = a.Ufact; 00048 cond = a.cond; 00049 P = a.P; 00050 Q = a.Q; 00051 } 00052 return *this; 00053 } 00054 00055 ~sparse_base_lu (void) { } 00056 00057 lu_type L (void) const { return Lfact; } 00058 00059 lu_type U (void) const { return Ufact; } 00060 00061 SparseMatrix R (void) const { return Rfact; } 00062 00063 lu_type Y (void) const; 00064 00065 p_type Pc (void) const; 00066 00067 p_type Pr (void) const; 00068 00069 ColumnVector Pc_vec (void) const; 00070 00071 ColumnVector Pr_vec (void) const; 00072 00073 PermMatrix Pc_mat (void) const; 00074 00075 PermMatrix Pr_mat (void) const; 00076 00077 const octave_idx_type * row_perm (void) const { return P.fortran_vec (); } 00078 00079 const octave_idx_type * col_perm (void) const { return Q.fortran_vec (); } 00080 00081 double rcond (void) const { return cond; } 00082 00083 protected: 00084 00085 lu_type Lfact; 00086 lu_type Ufact; 00087 SparseMatrix Rfact; 00088 00089 double cond; 00090 00091 MArray<octave_idx_type> P; 00092 MArray<octave_idx_type> Q; 00093 }; 00094 00095 #endif 00096 00097 /* 00098 ;;; Local Variables: *** 00099 ;;; mode: C++ *** 00100 ;;; End: *** 00101 */