Skip to contents

EnsembleContext(sim_id, repeat_, worker_id, sim_seed, rng, master_rng) describes one trajectory of an ensemble solve: its index, the number of the repetition (field repeat), the worker, the seed of the trajectory and the random number generators. EnsembleTestSolution() is an ensemble solution of a problem with an analytic solution together with its error summaries: the errors of each trajectory, the weak errors of the mean and the mean and median errors (as calculate_ensemble_errors() computes them); sim may be an EnsembleSolution() whose trajectories, time and convergence it takes.

Usage

EnsembleContext(
  sim_id,
  repeat_ = 1L,
  worker_id = 1L,
  sim_seed = NULL,
  rng = NULL,
  master_rng = NULL
)

EnsembleTestSolution(
  sim,
  errors,
  weak_errors,
  error_means,
  error_medians,
  elapsedTime = 0,
  converged = TRUE
)

Arguments

sim_id, repeat_, worker_id

The trajectory, repetition and worker.

sim_seed

The seed of the trajectory.

rng, master_rng

Random number generators, or NULL.

sim

An ensemble solution or the list of trajectories.

errors, weak_errors, error_means, error_medians

Named error summaries.

elapsedTime

The run time.

converged

Whether the ensemble converged.

Value

An EnsembleContext or an EnsembleTestSolution.

Examples

ctx <- EnsembleContext(3, 1, 1, 42)
ctx$sim_id
#> [1] 3
ts <- EnsembleTestSolution(list(1, 2), list(final = c(0.1, 0.2)), list(final = 0.05),
                           list(final = 0.15), list(final = 0.15), 0.1, TRUE)
ts$error_means$final
#> [1] 0.15