#include <Ludecomp.hpp>
Inheritance diagram for TLUDecomp::
Public Methods | |
TLUDecomp (const smatrix< t > &m, bool bWithPartialPivot) | |
TLUDecomp (const t *d, size_t iDim, size_t jDim, bool bWithPartialPivot) | |
TLUDecomp () | |
bool | Decompose (const smatrix< t > &m, bool bWithPartialPivot) |
void | FwdElim (smatrix< t > &c) const |
void | BackElim (smatrix< t > &c) const |
bool | Decompose (bool bWithPartialPivot) |
smatrix< t > | Solve (const smatrix< t > &m) const |
smatrix< t > | Inverse () const |
smatrix< t > | L () const |
smatrix< t > | U () const |
smatrix< t > | P () const |
Protected Attributes | |
smatrix< t > | pivots |
bool | bDecomposed |
|
Definition at line 10 of file Ludecomp.hpp. 00010 : 00011 smatrix<t>(m) 00012 { 00013 bDecomposed = false; 00014 if(Decompose(bWithPartialPivot) == false) 00015 { 00016 pivots = smatrix<t>(); 00017 *this = TLUDecomp<t>(); 00018 } 00019 } |
|
Definition at line 20 of file Ludecomp.hpp. 00021 : smatrix<t> (d, iDim, jDim) 00022 { 00023 bDecomposed = false; 00024 if(Decompose(bWithPartialPivot) == false) 00025 { 00026 pivots = smatrix<t>(); 00027 *this = TLUDecomp<t>(); 00028 } 00029 } |
|
Definition at line 30 of file Ludecomp.hpp. 00030 { bDecomposed = false; } |
|
Definition at line 56 of file Ludecomp.hpp. 00057 { 00058 for(size_t k = iDim; k >= 1; k--) 00059 { 00060 t Diag = t(-1.0) / Coef(k, k); 00061 const_iterator i = IterForCol(k); 00062 while(Index(i) < k) 00063 { 00064 t Scaler = Coef(i) * Diag; 00065 size_t r = Index(i++); 00066 c.row(r) += c.row(k) * Scaler; 00067 } 00068 c.row(k) *= -Diag; 00069 } 00070 } |
|
Definition at line 71 of file Ludecomp.hpp. 00072 { 00073 if(bDecomposed) return(true); 00074 if(iDim != jDim) return(false); 00075 pivots = smIdentity<t>(iDim); 00076 for(size_t k = 1; k < iDim; k++) 00077 { 00078 t Diag; 00079 if(!GetDiag(k, Diag, bWithPartialPivot, &pivots)) 00080 return(false); 00081 Diag = t(-1.0) / Diag; 00082 iterator i = IterForCol(k, k + 1); 00083 while(i != EndOfCol(k)) 00084 { 00085 t Scaler = Coef(i) * Diag; 00086 size_t r = Index(i++); 00087 row(r) += row(k, rng(k + 1, jDim)) * Scaler; 00088 Coef(r, k) = Scaler; 00089 } 00090 } 00091 t Diag = Coef(k, k); 00092 if(abs(Diag) < epsilon) 00093 return(false); 00094 bDecomposed = true; 00095 return(true); 00096 } |
|
Definition at line 31 of file Ludecomp.hpp. Referenced by TLUDecomp().
00032 { 00033 *this = m; 00034 bDecomposed = false; 00035 if(Decompose(bWithPartialPivot) == false) 00036 { 00037 pivots = smatrix<t>(); 00038 *this = TLUDecomp<t>(); 00039 return(false); 00040 } 00041 return(true); 00042 } |
|
Definition at line 43 of file Ludecomp.hpp. |
|
Definition at line 114 of file Ludecomp.hpp. 00115 { 00116 smatrix<t> c(pivots); 00117 if(bDecomposed) 00118 { 00119 FwdElim(c); 00120 BackElim(c); 00121 } 00122 return(c); 00123 } |
|
Definition at line 124 of file Ludecomp.hpp. |
|
Definition at line 141 of file Ludecomp.hpp. 00142 { 00143 return(pivots); 00144 } |
|
Definition at line 97 of file Ludecomp.hpp. Referenced by main().
00098 { 00099 smatrix<t> c(m.iDim, m.jDim, m.NZ); 00100 if(bDecomposed) 00101 { 00102 for(size_t r = 1; r <= iDim; r++) 00103 { 00104 const_svector_ref &v = m.row(r); 00105 const_iterator i = pivots.IterForCol(r); 00106 size_t x = Index(i); 00107 c.row(x) = v; 00108 } 00109 FwdElim(c); 00110 BackElim(c); 00111 } 00112 return(c); 00113 } |
|
Definition at line 134 of file Ludecomp.hpp. |
|
Definition at line 7 of file Ludecomp.hpp. |
|
Definition at line 6 of file Ludecomp.hpp. |