RngStream(parallel)
RngStream()所属R语言包:parallel
Implementation of Pierre L'Ecuyer's RngStreams
皮埃尔的欧莱雅Ecuyers RngStreams实施
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This is an R re-implementation of Pierre L'Ecuyer's "RngStreams" multiple streams of pseudo-random numbers.
这是一个伪随机数皮埃尔欧莱雅Ecuyers RngStreams多个流ŕ重新执行。
用法----------Usage----------
nextRNGStream(seed)
nextRNGSubStream(seed)
clusterSetRNGStream(cl, iseed)
mc.reset.stream()
参数----------Arguments----------
参数:seed
An integer vector of length 7 as given by .Random.seed when the "L'Ecuyer-CMRG" RNG is in use. See RNG for the valid values.
一个由长度为7的整数向量.Random.seed时"L'Ecuyer-CMRG"的RNG使用。看到RNG有效值。
参数:cl
A cluster from this package or package snow.
从这个包或包snow集群。
参数:iseed
An integer to be supplied to set.seed, or NULL not to set reproducible seeds.
整数set.seed或NULL不设置重复的种子供应。
Details
详情----------Details----------
The "RngStream" interface works with (potentially) multiple streams of pseudo-random numbers: this is particularly suitable for working with parallel computations since each task can be assigned a separate RNG stream.
“RngStream”接口与伪随机数(潜在的)的多个数据流:这是特别适合并行计算的工作,因为每个任务可以被分配一个单独的RNG流。
This uses as its underlying generator RNGkind("L'Ecuyer-CMRG"), of L'Ecuyer (1999), which has a seed vector of 6 (signed) integers and a period of around 2^191. Each "stream" is a subsequence of the period of length 2^127 which is in turn divided into "substreams" of length 2^76.
这作为其底层发电机RNGkind("L'Ecuyer-CMRG")的,欧莱雅Ecuyer(1999),其中有一个种子6(签名)整数向量和周围2^191期间,使用。每个“流”是一个序列的长度期间2^127依次分为“子流长度2^76。
The idea of L'Ecuyer et al (2002) is to use a separate stream for each of the parallel computations (which ensures that the random numbers generated never get into to sync) and the parallel computations can themselves use substreams if required. The original interface stores the original seed of the first stream, the original seed of the current stream and the current seed: this could be implemented in R, but it is as easy to work by saving the relevant values of .Random.seed: see the examples.
的LEcuyer等人(2002)的想法是使用每一个单独的数据流的并行计算(保证随机数生成从未进入同步),并行计算,可以自己使用,如果需要子流。原来的接口存储当前流和当前种子的原始种子:第一个流的原始种子,可以实现在研发,但它是由保存.Random.seed相关的值容易:见的例子。
clusterSetRNGStream selects the "L'Ecuyer-CMRG" RNG and then distributes streams to the members of a cluster, optionally setting the seed of the streams by set.seed(iseed) (otherwise they are set from the current seed of the master process: after selecting the L'Ecuyer generator).
clusterSetRNGStream选择"L'Ecuyer-CMRG"RNG和再分发流群集成员,可选设置种子流set.seed(iseed)(否则他们是从主进程当前种子:选择后的LEcuyer发生器)。
值----------Value----------
For nextRNGStream and nextRNGSubStream, a value which can be assigned to .Random.seed.
为nextRNGStream和nextRNGSubStream,一个可以被分配到.Random.seed的价值。
注意----------Note----------
Interfaces to L'Ecuyer's C code are available in CRAN packages rlecuyer and rstream.
欧莱雅Ecuyers C代码的接口是在CRAN的软件包rlecuyer和rstream。
作者(S)----------Author(s)----------
Brian Ripley
参考文献----------References----------
multiple recursive random number generators. Operations Research 47, 159–164.
An object-oriented random-number package with many long streams and substreams. Operations Research 50 1073–5.
参见----------See Also----------
RNG for fuller details of R's built-in random number generators.
RNGR的随机数发生器内置的更详尽的资料。
The vignette for package parallel.
包parallel的小插曲。
举例----------Examples----------
RNGkind("L'Ecuyer-CMRG")
set.seed(123)
(s <- .Random.seed)
## do some work involving random numbers.[#做了一些工作,涉及的随机数。]
nextRNGStream(s)
nextRNGSubStream(s)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|