C++ version of gibbs sampler complete