simulate_parallel: Parallel simulation of a Whittle-Matérn field on a metric...

View source: R/graph_simulate.R

simulate_parallelR Documentation

Parallel simulation of a Whittle-Matérn field on a metric graph

Description

Calls simulate.metric_graph() with parallel = TRUE. The edge loop is distributed over a doParallel/foreach cluster.

Usage

simulate_parallel(graph, ..., n_cores = NULL, cluster = NULL)

Arguments

graph

A metric_graph object.

...

Further arguments passed to simulate.metric_graph(), including alpha, method, kappa/tau or range/sigma, PtE, type, BC, nsim, and seed.

n_cores

Number of parallel workers.

cluster

An already-registered doParallel cluster.

Value

Numeric vector (nsim = 1) or matrix with nsim columns.

See Also

sample_spde()

Examples


V <- rbind(c(0,0), c(1,0), c(1,1), c(0,1))
E <- rbind(c(1,2), c(2,3), c(3,4), c(4,1))
g <- metric_graph$new(V = V, E = E)
t_norm <- seq(0.1, 0.9, by = 0.2)
PtE    <- do.call(rbind, lapply(1:4, function(e) cbind(e, t_norm)))
u <- simulate_parallel(g, alpha = 1, method = "kriging",
                       kappa = 1, tau = 1, PtE = PtE, n_cores = 2)


MetricGraph documentation built on Nov. 11, 2026, 1:09 a.m.