def test_1(): Z = np.array([[1, 10, 2], [2, 26, 3], [15, 20, 20]]).astype(np.double) value1 = list(metzner_mcmc_fast(Z, 4, n_thin=1, random_state=0)) value2 = list(metzner_mcmc_slow(Z, 4, n_thin=1, random_state=0)) np.testing.assert_array_almost_equal(np.array(value1), np.array(value2)) value3 = list(metzner_mcmc_fast(Z, 4, n_thin=2, random_state=0)) value4 = list(metzner_mcmc_slow(Z, 4, n_thin=2, random_state=0)) np.testing.assert_array_almost_equal(np.array(value3), np.array(value4)) np.testing.assert_array_almost_equal(np.array(value1)[1::2], np.array(value3))
def test_1(): Z = np.array([[1, 10, 2], [2, 26, 3], [15, 20, 20]]).astype(np.double) value1 = list(metzner_mcmc_fast(Z, 4, n_thin=1, random_state=0)) value2 = list(metzner_mcmc_slow(Z, 4, n_thin=1, random_state=0)) np.testing.assert_array_almost_equal(np.array(value1), np.array(value2)) value3 = list(metzner_mcmc_fast(Z, 4, n_thin=2, random_state=0)) value4 = list(metzner_mcmc_slow(Z, 4, n_thin=2, random_state=0)) np.testing.assert_array_almost_equal(np.array(value3), np.array(value4)) np.testing.assert_array_almost_equal( np.array(value1)[1::2], np.array(value3))
def test_2(): Z = np.array([[5., 2.], [1., 10.]]) value1 = list(metzner_mcmc_fast(Z, 100, n_thin=1, random_state=0)) value2 = list(metzner_mcmc_slow(Z, 100, n_thin=1, random_state=0)) np.testing.assert_array_almost_equal(np.array(value1), np.array(value2)) assert np.all(np.array(value1) > 0)