## [Vxl-maintainers] get_JtJ() in vnl_levenberg_marquardt

 [Vxl-maintainers] get_JtJ() in vnl_levenberg_marquardt From: Gehua Yang - 2004-11-19 22:18:19 ```Opposite to what the comments claimed, Jacobian'*Jacobian is in fact the INVERSE of covariance, rather than covariance itself. This can be verified with linear function Ax=b. In least squares sense, the obj function is ||Ax-b||, the estimate is inverse(A'A)*A'b, and the covariance of estimate is sigma*inverse(A'A). In this context, Jacobian is indeed matrix A. There are other problems with get_JtJ() function. 1) matrix fdjac_ is in FORTRAN style. It should be converted back to C style before taking upper triangular matrix. 2) According to documentation, fdjac_ is m x n matrix, of which n x n block is upper trianglue matrix r. But in fact the lower part of r has non-zeros. I added a test case with linear function Ax=b, and made sure what get_JtJ() returns is A'*A. Could anyone familiar with this part of work comment on the above changes? P.S. the member variables are pointers and allocate memory from heap. I don't see the need for it and therefore changd them from pointers to real objects. Regards, Gehua Yang ```

 [Vxl-maintainers] get_JtJ() in vnl_levenberg_marquardt From: Gehua Yang - 2004-11-19 22:18:19 ```Opposite to what the comments claimed, Jacobian'*Jacobian is in fact the INVERSE of covariance, rather than covariance itself. This can be verified with linear function Ax=b. In least squares sense, the obj function is ||Ax-b||, the estimate is inverse(A'A)*A'b, and the covariance of estimate is sigma*inverse(A'A). In this context, Jacobian is indeed matrix A. There are other problems with get_JtJ() function. 1) matrix fdjac_ is in FORTRAN style. It should be converted back to C style before taking upper triangular matrix. 2) According to documentation, fdjac_ is m x n matrix, of which n x n block is upper trianglue matrix r. But in fact the lower part of r has non-zeros. I added a test case with linear function Ax=b, and made sure what get_JtJ() returns is A'*A. Could anyone familiar with this part of work comment on the above changes? P.S. the member variables are pointers and allocate memory from heap. I don't see the need for it and therefore changd them from pointers to real objects. Regards, Gehua Yang ```