From 4a2422394f5a91b003758d270bd8c4205040ed5d Mon Sep 17 00:00:00 2001 From: philchalmers Date: Fri, 16 Aug 2024 12:21:44 -0400 Subject: [PATCH] export function --- NAMESPACE | 1 + R/util.R | 16 ++++++++++++++++ man/clusterSetRNGSubStream.Rd | 25 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 man/clusterSetRNGSubStream.Rd diff --git a/NAMESPACE b/NAMESPACE index eedca27..6ce14c2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -46,6 +46,7 @@ export(aggregate_simulations) export(bias) export(bootPredict) export(boot_predict) +export(clusterSetRNGSubStream) export(colSDs) export(colVars) export(createDesign) diff --git a/R/util.R b/R/util.R index 8301624..13db8a6 100644 --- a/R/util.R +++ b/R/util.R @@ -695,6 +695,22 @@ set_seed <- function(seed){ recvResult_fun <- utils::getFromNamespace("recvResult", "snow") +#' Set RNG sub-stream for Pierre L'Ecuyer's RngStreams +#' +#' Sets the sub-stream RNG state within for Pierre L'Ecuyer's (1999) +#' algorithm. Should be used within distributed array jobs +#' after suitable L'Ecuyer's (1999) have been distributed to each array, and +#' each array is further defined to use multi-core processing. See +#' \code{\link[parallel]{clusterSetRNGStream}} for further information. +#' +#' @param seed An integer vector of length 7 as given by \code{.Random.seed} when +#' the L'Ecuyer-CMR RNG is in use. See\code{\link{RNG}} for the valid values +#' @param cl A cluster from the \code{parallel} or \code{snow} package, or +#' (if \code{NULL}) the registered cluster +#' @return invisible NULL +#' @export +#' +#' clusterSetRNGSubStream <- function(cl, seed){ nc <- length(cl) seeds <- vector("list", nc) diff --git a/man/clusterSetRNGSubStream.Rd b/man/clusterSetRNGSubStream.Rd new file mode 100644 index 0000000..3645f09 --- /dev/null +++ b/man/clusterSetRNGSubStream.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/util.R +\name{clusterSetRNGSubStream} +\alias{clusterSetRNGSubStream} +\title{Set RNG sub-stream for Pierre L'Ecuyer's RngStreams} +\usage{ +clusterSetRNGSubStream(cl, seed) +} +\arguments{ +\item{cl}{A cluster from the \code{parallel} or \code{snow} package, or +(if \code{NULL}) the registered cluster} + +\item{seed}{An integer vector of length 7 as given by \code{.Random.seed} when +the L'Ecuyer-CMR RNG is in use. See\code{\link{RNG}} for the valid values} +} +\value{ +invisible NULL +} +\description{ +Sets the sub-stream RNG state within for Pierre L'Ecuyer's (1999) +algorithm. Should be used within distributed array jobs +after suitable L'Ecuyer's (1999) have been distributed to each array, and +each array is further defined to use multi-core processing. See +\code{\link[parallel]{clusterSetRNGStream}} for further information. +}