kkobayashi #4525(2007/11/30 16:02 GMT) [ R ] Rating0/0=0.00
Pentium4 2.4GHzで656秒w お題のうち「分割」だけならparts()という関数で、0.66秒なのですが・・・。 stdoutへのcatとループ(apply)が泣きそうなほど遅いです。 > sink("young50.dat") > Rprof(); young(50); Rprof(NULL) > summaryRprof() $by.self self.time self.pct total.time total.pct cat 471.62 71.9 533.42 81.3 lapply 41.74 6.4 622.78 94.9 FUN 39.52 6.0 649.92 99.1 stdout 29.98 4.6 29.98 4.6 (中略) parts 0.20 0.0 0.66 0.1 (中略) young 0.00 0.0 656.10 100.0
1 2 3 4
library("partitions") young <- function(n){ invisible(apply(parts(n), 2, function(v)(sapply(v, function(x)(cat(rep("□", x), "\n", sep="")))))) }
Rating0/0=0.00-0+
[ reply ]
kkobayashi
#4525()
[
R
]
Rating0/0=0.00
Pentium4 2.4GHzで656秒w お題のうち「分割」だけならparts()という関数で、0.66秒なのですが・・・。 stdoutへのcatとループ(apply)が泣きそうなほど遅いです。 > sink("young50.dat") > Rprof(); young(50); Rprof(NULL) > summaryRprof() $by.self self.time self.pct total.time total.pct cat 471.62 71.9 533.42 81.3 lapply 41.74 6.4 622.78 94.9 FUN 39.52 6.0 649.92 99.1 stdout 29.98 4.6 29.98 4.6 (中略) parts 0.20 0.0 0.66 0.1 (中略) young 0.00 0.0 656.10 100.0library("partitions") young <- function(n){ invisible(apply(parts(n), 2, function(v)(sapply(v, function(x)(cat(rep("□", x), "\n", sep="")))))) }Rating0/0=0.00-0+
[ reply ]