collapsed Gibbs sampler + speed improvement (vectors -> arrays)