Skip to main content

sampleobservation_replicate_chunks

Function sampleobservation_replicate_chunks 

Source
pub fn sampleobservation_replicate_chunks<R, F>(
    spec: &GenerativeSpec,
    n_draws: usize,
    chunk_draws: usize,
    rng: &mut R,
    consume: F,
) -> Result<(), EstimationError>
where R: Rng + ?Sized, F: for<'a> FnMut(usize, ArrayBase<ViewRepr<&'a f64>, Dim<[usize; 2]>>) -> Result<(), EstimationError>,
Expand description

Draw replicate chunks in deterministic draw order without materializing the full n_draws × nobs matrix.

The same RNG is advanced exactly once per observation draw regardless of chunk_draws, so changing the chunk size changes only memory and sink call boundaries, never the generated values. Frontends that write a file or yield an iterator should use this API; collecting the full matrix is an explicit convenience operation implemented below.