Closed syclik closed 8 years ago
What’s the utility of using a typedef instead of templating everything out?
On Oct 29, 2015, at 2:17 PM, Daniel Lee notifications@github.com wrote:
Feature Request
Description
(This is part of @betanalpha's #1361 implementation.)
Update stan/mcmc/hmc/hamiltonians/base_hamiltonian.hpp: Rename template arguments from M to Model and P to Point. Add typedef of Point to PointType. Update all hamiltonians. Update uses of hamiltonians: remove template parameter P, rename H to Hamiltonian, use Hamiltonian::PointType in place of P. stan/mcmc/hmc/integrators/base_leapfrog.hpp stan/mcmc/hmc/integrators/expl_leapfrog.hpp stan/mcmc/hmc/nuts/base_nuts.hpp stan/mcmc/hmc/static/base_static_hmc.hpp stan/mcmc/hmc/static/dense_e_static_hmc.hpp stan/mcmc/hmc/static/diag_e_static_hmc.hpp stan/mcmc/hmc/static/unit_e_static_hmc.hpp There might be a few more uses.
Additional Information
This was completely unrelated to #1361, so should be split out. I like the changes and won't affect the interfaces. This will cut down the diff of @betanalpha's branch for #1361, so it'll be easier to tell what's going on there. — Reply to this email directly or view it on GitHub.
Great question. This was snuck into the 1361 branch. @betanalpha, want to answer that for us?
I think it simplifies things so I'm in favor of it.
Great question. This was snuck into the 1361 branch. @betanalpha, want to answer that for us?
Dammit it’s confusing when you split these PR up like this. Putting a typedef in the Hamltonian removes a bunch of duplicated info in the template arguments which should speed up compilation (somewhat) and avoid conflicting template decorations (more important).
Also
stan/mcmc/hmc/nuts/dense_e_nuts.hpp stan/mcmc/hmc/nuts/diag_e_nuts.hpp stan/mcmc/hmc/nuts/unit_e_nuts.hpp
will have to be updated.
Feature Request
Description
(This is part of @betanalpha's #1361 implementation.)
stan/mcmc/hmc/hamiltonians/base_hamiltonian.hpp
:M
toModel
andP
toPoint
.Point
toPointType
.P
, renameH
toHamiltonian
, useHamiltonian::PointType
in place ofP
.stan/mcmc/hmc/integrators/base_leapfrog.hpp
stan/mcmc/hmc/integrators/expl_leapfrog.hpp
stan/mcmc/hmc/nuts/base_nuts.hpp
stan/mcmc/hmc/static/base_static_hmc.hpp
stan/mcmc/hmc/static/dense_e_static_hmc.hpp
stan/mcmc/hmc/static/diag_e_static_hmc.hpp
stan/mcmc/hmc/static/unit_e_static_hmc.hpp
stan/mcmc/hmc/base_hmc.hpp
There might be a few more uses.
Additional Information