-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
armadillo 8.400 RC1 #201
Comments
@conradsnicta a thousand thanks for the work on the random number generation, e.g. scalars + wishart! (You've also just blown up the use one of my packages... But, I'll take it!) |
@conradsnicta few quick remarks:
# Build the C++ function
Rcpp::cppFunction("arma::mat test_rwishart(arma::mat S, int df) {
return arma::wishrnd(S, df);
}", plugins = "cpp11", depends = "RcppArmadillo")
# Run through tests:
## Artificial
S = toeplitz((10:1)/10)
set.seed(11)
R = replicate(1000, test_rwishart(S, 20))
dim(R)
# 10 10 1000
mR = apply(R, 1:2, mean)
# ~= E[ Wish(S, 20) ] = 20 * S
stopifnot(all.equal(mR, 20*S, tolerance = .009))
## See Details, the variance is
Va = 20*(S^2 + tcrossprod(diag(S)))
vR = apply(R, 1:2, var)
stopifnot(all.equal(vR, Va, tolerance = 1/16)) |
I checked
and everything came out as expected. One suggestion, however. Based on my experience, the df_simple case here is very inefficient when df is large (as tmp'tmp is costly to calculate). Example: when df = 1E05 and S = eye(3,3), the second implementation---similar to what I use in my library, but for integer df---runs ~ 100 times faster than df_simple, even with multi-threaded BLAS. Perhaps remove the df_simple case entirely, or include a |
I ran a complete reverse depends check and just going over the results -- we may have one regression in one package that I need to look at more closely. |
Looked at that package--it fails with the CRAN version of RcppArmadillo too so no regression here. |
No description provided.
The text was updated successfully, but these errors were encountered: