From 9c0f0be2d375fe026fde78449f431e947b15f51c Mon Sep 17 00:00:00 2001 From: Otto Vintola Date: Fri, 14 Aug 2026 18:33:50 +0300 Subject: [PATCH] fix arguments of setup_chain --- python/bartrs/pgbart.py | 3 ++- src/lib.rs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/python/bartrs/pgbart.py b/python/bartrs/pgbart.py index 0255374..4277bb7 100644 --- a/python/bartrs/pgbart.py +++ b/python/bartrs/pgbart.py @@ -281,7 +281,8 @@ def competence(var, has_grad): return Competence.IDEAL return Competence.INCOMPATIBLE - def setup(self, tune: int, draws: int) -> None: + def setup_chain(self, rng: np.random.Generator, tune: int, draws: int) -> None: + # Maybe we use the _rng in later versions self.n_draws = draws self.pg_bart.reserve_draws(draws) diff --git a/src/lib.rs b/src/lib.rs index 1fd8491..808e9dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -232,7 +232,9 @@ impl PySampler { } fn reserve_draws(&mut self, draws: usize) { - self.all_trees = Vec::with_capacity(draws); + if self.all_trees.len() == 0 { + self.all_trees = Vec::with_capacity(draws); + } } #[pyo3(signature = (tune = None))]