parallel_dispatch: Internal Parallel Dispatcher for Importance Sampling

View source: R/mc_is_helpers.R

parallel_dispatchR Documentation

Internal Parallel Dispatcher for Importance Sampling

Description

Internal helper function used by MC_IS_single() to distribute Monte Carlo sample blocks across worker threads in a reproducible and backend-independent manner.

The function ensures worker-invariant execution by:

  • Performing deterministic chunking of sample indices,

  • Avoiding per-worker random number generation,

  • Supporting both "future" and "parallel" backends.

This abstraction isolates parallel execution from the statistical core of the Importance Sampling algorithm.

Usage

parallel_dispatch(
  chunk_indices,
  worker_fun,
  u_mat,
  use_threads,
  backend,
  debug.level = 0
)

Arguments

chunk_indices

List of integer vectors defining sample indices assigned to each worker.

worker_fun

Function that evaluates a given subset of samples.

u_mat

Matrix of samples in standard normal space.

use_threads

Number of worker threads.

backend

Character string specifying backend ("future" or "parallel").

debug.level

Verbosity level for diagnostic output.

Value

A list containing worker evaluation results.


TesiproV documentation built on Oct. 28, 2026, 5:13 p.m.