Skip to content

Commit

Permalink
更新了好多
Browse files Browse the repository at this point in the history
所以记不得了
  • Loading branch information
jmShen committed Jul 31, 2019
1 parent d1d5b58 commit 2316d29
Show file tree
Hide file tree
Showing 25 changed files with 2,279 additions and 74 deletions.
34 changes: 34 additions & 0 deletions 10-R-trick.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,37 @@ for (i in 1:100) {
total = iter, clear = FALSE)
```


-[Benchmark](https://www.alexejgossmann.com/benchmarking_r/)

其中的试例代码:
```
benchmark("lm" = {
X <- matrix(rnorm(1000), 100, 10)
y <- X %*% sample(1:10, 10) + rnorm(100)
b <- lm(y ~ X + 0)$coef
},
"pseudoinverse" = {
X <- matrix(rnorm(1000), 100, 10)
y <- X %*% sample(1:10, 10) + rnorm(100)
b <- solve(t(X) %*% X) %*% t(X) %*% y
},
"linear system" = {
X <- matrix(rnorm(1000), 100, 10)
y <- X %*% sample(1:10, 10) + rnorm(100)
b <- solve(t(X) %*% X, t(X) %*% y)
},
replications = 1000,
columns = c("test", "replications", "elapsed",
"relative", "user.self", "sys.self"))
```

可以很简单的改成我的代码:
```
benchmark("Rvec2tril"=BayesJMCM::vec2tril(phiiVec)
"Rcppvec2tril"=vec2trilcpp(phiiVec)
)
```

Loading

0 comments on commit 2316d29

Please sign in to comment.