Skip to content

Commit 298bd92

Browse files
committed
perf: shortcut for empty posteriors
1 parent d0984b9 commit 298bd92

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/nuts.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,13 @@ where
274274
collector.register_init(math, init, options);
275275

276276
let mut tree = NutsTree::new(init.clone());
277+
278+
if math.dim() == 0 {
279+
let info = tree.info(false, None);
280+
collector.register_draw(math, init, &info);
281+
return Ok((init.clone(), info));
282+
}
283+
277284
while tree.depth < options.maxdepth {
278285
let direction: Direction = rng.random();
279286
tree = match tree.extend(math, rng, hamiltonian, direction, collector, options) {

0 commit comments

Comments
 (0)