def test_run(self):
    sampler = gibbs.RandGibbsAlgo(num_dim=2, initial_state=np.array([2, 3]), dimen_prob=np.array([2, 5]))
    first_1_d_sampler = gibbs.OneDimSampler(scipy.stats.norm.rvs, fun)
    second_1_d_sampler = gibbs.OneDimSampler(scipy.stats.norm.rvs, another_fun)
    sampler.add_1_d_sampler(first_1_d_sampler)
    sampler.add_1_d_sampler(second_1_d_sampler)
    sampler.run(num_cycles=3)
    last_state = sampler.chain_states[(- 1)]
    self.assertEqual(len(sampler.chain_states), 4)
    self.assertEqual(len(last_state), len(sampler.initial_state))
    npt.assert_array_equal(last_state, sampler.current_state)
    sampler.run(num_cycles=3, mode='continue')
    self.assertEqual(len(sampler.chain_states), 7)
    sampler.run(num_cycles=3, mode='restart')
    self.assertEqual(len(sampler.chain_states), 4)
def test_run(self):
    sampler = gibbs.RandGibbsAlgo(num_dim=2, initial_state=np.array([2, 3]), dimen_prob=np.array([2, 5]))
    first_1_d_sampler = gibbs.OneDimSampler(scipy.stats.norm.rvs, fun)
    second_1_d_sampler = gibbs.OneDimSampler(scipy.stats.norm.rvs, another_fun)
    sampler.add_1_d_sampler(first_1_d_sampler)
    sampler.add_1_d_sampler(second_1_d_sampler)
    sampler.run(num_cycles=3)
    last_state = sampler.chain_states[(- 1)]
    self.assertEqual(len(sampler.chain_states), 4)
    self.assertEqual(len(last_state), len(sampler.initial_state))
    npt.assert_array_equal(last_state, sampler.current_state)
    sampler.run(num_cycles=3, mode='continue')
    self.assertEqual(len(sampler.chain_states), 7)
    sampler.run(num_cycles=3, mode='restart')
    self.assertEqual(len(sampler.chain_states), 4)