  The problem of the reconstruction of the large scale density and velocity
fields from peculiar velocities surveys is addressed here within a Bayesian
framework by means of Hamiltonian Monte Carlo (HMC) sampling. The HAmiltonian
Monte carlo reconstruction of the Local EnvironmenT (Hamlet) algorithm is
designed to reconstruct the linear large scale density and velocity fields in
conjunction with the undoing of lognormal bias in the derived distances and
velocities of peculiar velocities surveys such as the Cosmicflows data. The
Hamlet code has been tested against Cosmicflows mock catalogs consisting of up
to 30 000 data points with mock errors akin to those of the Cosmicflows-3 data,
within the framework of the LCDM standard model of cosmology.
  The Hamlet code outperforms previous applications of Gibbs sampling MCMC
reconstruction from the Cosmicflows-3 data by two to four orders of magnitude
in CPU time. The gain in performance is due to the inherent higher efficiency
of the HMC algorithm and due to parallel computing on GPUs rather than CPUs.
This gain will enable an increase in the reconstruction of the large scale
structure from the upcoming Cosmicfows-4 data and the setting of constrained
initial conditions for cosmological high resolution simulations.
