1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Reusable per-sweep scratch for the sequential-Gaussian sweep.
use crate;
use crateNeighbourhood;
/// Reusable per-sweep scratch for [`simulate_scores`](super::sweep::simulate_scores).
/// Every buffer here is **layer-invariant in shape** (its size is fixed by the
/// lattice) but **layer-varying in content** — so an
/// [`SgsSession`](super::session::SgsSession) retains one set across all layers and
/// re-fills them each sweep, paying the (large) allocation once instead of per
/// layer.
///
/// What is retained and why:
/// - `inf_pos` / `inf_val` / `path` — the informed-node arrays and the visiting
/// path, each grown to `ncol · nrow`; cleared and re-pushed per sweep.
/// - `near` / `neighbours` — the per-node neighbour scratch (queried once per
/// node); cleared and re-filled per node.
/// - `sk` — the [`SkScratch`] kriging solver buffers (matrix/rhs/perm/solution),
/// reused across every node of every layer with **zero** per-node allocation.
/// - `nb` — the R*-tree search index. This one is **rebuilt** per sweep, not
/// reused: the tree grows in *visiting-path order* (each simulated node is
/// inserted as it is drawn) and the path differs per layer (conditioning
/// membership differs), so the tree's contents and insertion order genuinely
/// differ between layers. Bulk-reloading a retained frame would change the
/// nearest-neighbour tie-breaking at the `max_n` boundary and so break the
/// bit-for-bit determinism petekStatic pins. It is kept in the scratch only so
/// the `Neighbourhood` allocation is co-located; each sweep starts a fresh tree.
pub