Revision 795 branches/replacement/src/linad99/ludcmp.cpp
ludcmp.cpp (revision 795)  

3  3 
* 
4  4 
* Copyright (c) 2009 ADMB Foundation 
5  5 
*/ 
6 
/** 

7 
* \file 

8 
* This file contains the routines necessary to compute 

9 
* the LU decomposition of a matrix 

10 
*/ 

6  11  
7  12 
#include <ludcmp.hpp> 
8  13  
...  ...  
12  17 
const cltudecomp & dfclu, 
13  18 
const ivector & index2); 
14  19  
20 
/** 

21 
* LU Decomposition of a Matrix 

22 
* \param M \f$M\f$ a square matrix to decompose 

23 
* \return a cltudecomp object containg the 

24 
* upper and lower parts of the decomposed matrix 

25 
*/ 

15  26 
cltudecomp ludecomp(const dmatrix & M) 
16  27 
{ 
17  28 
int mmin = M.indexmin(); 
...  ...  
121  132 
} 
122  133 
} 
123  134  
124  
125  135 
// OUTER LOOP2 
126  136 
//for (int j=mmin;j<=mmax;j++) 
127  137 
for (j = mmax; j >= mmin; j) 
...  ...  
206  216 
return dfM; 
207  217 
} 
208  218  
209 
// LU decomp with partial pivoting 

219  
220 
/** 

221 
* LU decomp with partial pivoting 

222 
* \param M \f$M\f$ a constant square matrix to decompose 

223 
* \return a cltudecomp object containg the 

224 
* upper and lower parts of the decomposed matrix 

225 
* as well as an index that keeps track of the 

226 
* pivots. 

227 
*/ 

210  228 
cltudecomp ludecomp_pivot(const dmatrix & M) 
211  229 
{ 
212  230 
int i, j, k; 
...  ...  
301  319 
return clu; 
302  320 
} 
303  321  
304 
// LU decomp with partial pivoting 

322 
/** 

323 
* LU decomp with partial pivoting 

324 
* \param M \f$M\f$ a variable square matrix to decompose 

325 
* \return a cltudecomp object containg the 

326 
* upper and lower parts of the decomposed matrix 

327 
* as well as an index that keeps track of the 

328 
* pivots. 

329 
*/ 

305  330 
cltudecomp xludecomp_pivot(const dvar_matrix & M) 
306  331 
{ 
307  332 
Also available in: Unified diff