1% WALNUTS sampling of a 2D "banana" target.
2%
3% WALNUTS (Within-orbit Adaptive No-U-Turn Sampler) is a NUTS variant that
4% adapts the leapfrog step size within each orbit. This draws samples from the
5% banana target and shows the density with the samples on top.
6%
7% The algorithm lives in helpers/walnuts.m; the target in helpers/log_density.m
8% and helpers/grad_log_density.m. `addpath` must be the first statement.
10addpath('helpers'); % walnuts, log_density, grad_log_density
12rng(1); % reproducible
14walnuts_sampler(1000, 0.4, 0.8); % N samples, leapfrog dt, max energy error