indexed compartment metropolis sampler code