Revision 795 branches/replacement/src/linad99/ludcmp_ln_det.cpp
ludcmp_ln_det.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 natural log of the determinate of a matrix 

10 
*/ 

6  11  
7  12 
#include <ludcmp.hpp> 
8  13  
9  14 
cltudecomp xludecomp_pivot(const dvar_matrix & M); 
10  15 
cltudecomp ludecomp_pivot(const dmatrix & M); 
11  16  
17 
/** 

18 
* Compute log determinant of a constant dvar_matrix. 

19 
* \param aa A dvar_dmatrix, \f$M\f$, for which the determinant is computed. 

20 
* \return A dvariable containing \f$\log(M)\f$. 

21 
*/ 

12  22 
dvariable ln_det(const dvar_matrix & a) 
13  23 
{ 
14  24 
int sgn; 
...  ...  
17  27  
18  28 
static void df_my_ln_det(void); 
19  29  
30 
/** 

31 
* Compute log determinant of a constant dvar_matrix. 

32 
* \param aa A dvar_dmatrix, \f$M\f$, for which the determinant is computed. 

33 
* \param _sgn the sign of the log 

34 
* \return A dvariable containing \f$\log(M)\f$. 

35 
*/ 

20  36 
dvariable my_ln_det(const dvar_matrix & M, int &sign) 
21  37 
{ 
22  38 
cltudecomp clu1 = xludecomp_pivot(M); 
...  ...  
86  102  
87  103 
/** Compute log determinant of a constant dvar_matrix. 
88  104 
\param aa A dvar_dmatrix, \f$M\f$, for which the determinant is computed. 
89 
\param _sgn 

105 
\param _sgn the sign of the log


90  106 
\return A dvariable containing \f$\log(M)\f$. 
91  107 
*/ 
92  108 
dvariable ln_det(const dvar_matrix & aa, const int &_sgn) 
...  ...  
107  123  
108  124 
/** Compute log determinant of a constant matrix. 
109  125 
\param m1 A dmatrix, \f$M\f$, for which the determinant is computed. 
110 
\param _sgn 

126 
\param _sgn the sign of the log


111  127 
\return A double containing \f$\log(M)\f$. 
112  128 
*/ 
113  129 
double ln_det(const dmatrix & m1, const int &_sgn) 
Also available in: Unified diff