次のような for ループがあります。
for (i=1:150000) {
tempMatrix = {}
tempMatrix = functionThatDoesSomething() #calling a function
finalMatrix = cbind(finalMatrix, tempMatrix)
}
これを平行にする方法を教えてください。
オンラインの例に基づいてこれを試しましたが、構文が正しいかどうかわかりません。スピードもあまり伸びませんでした。
finalMatrix = foreach(i=1:150000, .combine=cbind) %dopar% {
tempMatrix = {}
tempMatrix = functionThatDoesSomething() #calling a function
cbind(finalMatrix, tempMatrix)
}