Displaying 1 result from an estimated 1 matches for "sigmahalf".
2012 Aug 06
1
more efficient way to parallel
...how to modify it. I have a simple code here. Only two
sapply's involved for simplicity. The logical in the sapply is not
important.
Thank you for your attention and suggestion.
library(parallel)
library(MASS)
result.seq=c()
Maxi <- 100
for (i in 1:Maxi)
{
## initialization, not of interest
Sigmahalf <- matrix(sample(1:10000,size = 10000,replace =T ), 100)
Sigma <- t(Sigmahalf)%*%Sigmahalf
x <- mvrnorm(n=1000, rep(0, 10), Sigma)
xlist <- list()
for (j in 1:1000)
{
xlist[[j]] <- list(X = matrix( x [j, ],5))
}
## end of initialization
dd1 <- sapply(xlist,function(s) {min(abs((...