I was trying to code review Marcus's pull request:
https://github.com/stan-dev/stan/pull/346/files
but got very confused by all the pointers flying around
in the very first file I looked at:
https://github.com/mbrubake/stan/blob/3d3b350cc407ea4feb5855ba853744c35d7a65ae/src/stan/agrad/rev/matrix/ldlt.hpp
For example, in LDLT_factor, there's a new in the second
constructor but there's no destructor in which it's freed.
Is that because it's going on the auto-diff memory alloc?
In mdivide_left_ldlt_alloc, it looks like there's a different
approach to memory management with a
boost::shared_ptr< Eigen::LDLT< Eigen::Matrix<double,R1,C1> > > _ldltP;
Maybe somebody else could review this code?
I'd rather not see code from different name spaces in the
same file. This ldlt.hpp file defines entries for stan::math
and stan::agrad. The point was that there shouldn't be any
dependency from math to agrad, so we could compile math separately.
We can't really do that if we mix stan::agrad and stan::math
definitions in a single file.
Given that we have outstanding bugs that already seem to be
malloc related, I'd like to be very careful before introduing
more pointer manipulation that isn't fully encapsulated.
- Bob