-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
It's nice to see dqrng being used. However, I think a slightly different pattern would be appropriate since it is only in Suggests. Right now you have
requireNamespace('dqrng')
[...]
#Mixi <- matrix(rnorm(n=x, mean=Means[d], sd=SDs[d]), nrow=AnzPoints[d], ncol=1)
#MT 2019/03: das ist die schnelle version fuer den bottleneck
Mixi <- matrix(dqrng::dqrnorm(n=x, mean=Means[d], sd=SDs[d]), nrow=AnzPoints[d], ncol=1) which will fail if dqrng is not installed. Instead you could either go from Suggests to Imports or use the fall-back pattern from Hadley's book
if (requireNamespace("dqrng", quietly = TRUE)) {
Mixi <- matrix(dqrng::dqrnorm(n=x, mean=Means[d], sd=SDs[d]), nrow=AnzPoints[d], ncol=1)
} else {
Mixi <- matrix(rnorm(n=x, mean=Means[d], sd=SDs[d]), nrow=AnzPoints[d], ncol=1)
}BTW, you might be interested that dqrng also has support for fast sampling. Support for more distribution functions (like lnorm) is planned.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels