def sample(self): """ Sample from the Poissonized Plancherel measure. """ N = np.random.poisson(self.theta) sigma = uniform_permutation(N) P, _ = RSK(sigma) # young_diag = [len(row) for row in P] young_diag = np.fromiter(map(len, P), dtype=int) self.list_of_young_diag.append(young_diag) # sampl = [len(row) - i + 0.5 for i, row in enumerate(P, start=1)] sampl = young_diag - np.arange(0.5, young_diag.size) self.list_of_samples.append(sampl.tolist())
def sample(self, random_state=None): """ Sample from the Poissonized Plancherel measure. :param random_state: :type random_state: None, np.random, int, np.random.RandomState """ rng = check_random_state(random_state) N = rng.poisson(self.theta) sigma = uniform_permutation(N, random_state=rng) P, _ = RSK(sigma) # young_diag = [len(row) for row in P] young_diag = np.fromiter(map(len, P), dtype=int) self.list_of_young_diag.append(young_diag) # sampl = [len(row) - i + 0.5 for i, row in enumerate(P, start=1)] sampl = young_diag - np.arange(0.5, young_diag.size) self.list_of_samples.append(sampl.tolist())
def test_RSK_output(self): for seq, tab in zip(self.sequences, self.PQ_tableaux): print(seq) self.assertTrue(RSK(seq) == tab)
def test_RSK_output(self): for i, (seq, tab) in enumerate(zip(self.sequences, self.PQ_tableaux)): with self.subTest(index=i, seq=seq): self.assertTrue(RSK(seq) == tab)