stan-dev/stan — pull request #599 by betanalpha (2014-03-11 16:59:22+00:00)
Title: Fix to NUTS slice criterion

Summary
-----

Bad parentheses and inadvertent casting. NUTS was implementing the slice criterion as

util.log_u + (h - util.H0) < 0

which computes a check on (h - until.H0) and then adds until.log_u before casting to a bool.
This pull request fixes this to

(util.log_u + (h - util.H0) ) < 0

so that the slice is taken into account correctly.

Intended Effect
-----

Proper check of the slice criterion.

How to Verify
-----

The slicing behavior (both for an accepted slice and the max_delta condition) are checked in the accompanying unit test. Run with mkfast test/unit/mcmc/hmc/base_nuts.

Side Effects
-----

No user-facing effects, will cause small differences in sampling behavior for some models.

Documentation
-----

None.

Suggested Reviewers
-----

Anyone, but @syclik should confirm if the unit test is sufficient.

@syclik, this is branched off v2.2.0. I've made it a hot fix targeted as master here, but you can close this and push to develop or a proper hot fix branch as you'd like.