Hello,
With Michael's sugestions (I keep forgeting package compiler)
t0 <- system.time({ ... variant 3.b ...
#
## Variant 3.c ##
#
install.packages("compiler")
libra
On Fri, Jun 15, 2012 at 9:48 AM, R. Michael Weylandt
wrote:
> As of recent versions of R, you can actually go for what are
> officially recognized as "ultimate speed" functions .rowSums() and
> friends.
Sorry, perhaps that wasn't totally clear. Regarding .rowSums() note
that leading period. You p
As of recent versions of R, you can actually go for what are
officially recognized as "ultimate speed" functions .rowSums() and
friends.
You might also use the compiler() package to byte-compile that inner
loop. [The function going to sapply] It won't be massive, but perhaps
another 3 or 4x
Micha
Rui, thank you very much.
I keep forgetting about the rowSum and friends. (precalculating the
powers just slipped my attention).
And, yes, a factor of will of course do. Do you see a further
improvement in this case?
Best,
Simon
On Fri, Jun 15, 2012 at 12:25 PM, Rui Barradas wrote:
> Hello,
Hello,
Will a factor of 4 do?
This is variant 3, revised.
#
## Variant 3.b ##
#
## Initialize matrix to hold results
singlecolor <- matrix(NA, simlength, noplayer)
#
Dear List Members
I used to play around with R to answer the following question by
simulation (I am aware there is an easy explicit solution, but this is
intended to serve as instructional example).
Suppose you have a poker game with 6 players and a deck of 52 cards.
Compute the empirical frequ
6 matches
Mail list logo