Re: [R] R parallel / foreach - aggregation of results

2015-08-01 Thread jim holtman
An: Martin Spindler martin.spind...@gmx.de Cc: r-help@r-project.org r-help@r-project.org Betreff: Re: [R] R parallel / foreach - aggregation of results Try this chance to actually return values: library(doParallel) Simpar3 - function(n1) { L2distance - matrix(NA, ncol=n1, nrow=n1

Re: [R] R parallel / foreach - aggregation of results

2015-08-01 Thread Martin Spindler
. Juli 2015 um 18:22 Uhr Von: jim holtman jholt...@gmail.com An: Martin Spindler martin.spind...@gmx.de Cc: r-help@r-project.org r-help@r-project.org Betreff: Re: [R] R parallel / foreach - aggregation of results Try this chance to actually return values:     library(doParallel) Simpar3 - function(n1

Re: [R] R parallel / foreach - aggregation of results

2015-08-01 Thread William Dunlap
: [R] R parallel / foreach - aggregation of results Try this chance to actually return values: library(doParallel) Simpar3 - function(n1) { L2distance - matrix(NA, ncol=n1, nrow=n1) data - rnorm(n1) diag(L2distance)=0 cl - makeCluster(4) registerDoParallel(cl) x

[R] R parallel / foreach - aggregation of results

2015-07-31 Thread Martin Spindler
Dear all, when I am running the code attached below, it seems that no results are returned, only the predefined NAs. What mistake do I make? Any comments and help is highly appreciated. Thanks and best, Martin Simpar3 - function(n1) { L2distance - matrix(NA, ncol=n1, nrow=n1) data -

Re: [R] R parallel / foreach - aggregation of results

2015-07-31 Thread Jon Skoien
Martin, I think the main problem is that you are trying to assign your results to the result matrix inside the foreach loop. Parallel functions in R are generally not good at updating parts of matrices from the different workers in this way. Instead, using e.g. foreach, each loop of the

Re: [R] R parallel / foreach - aggregation of results

2015-07-31 Thread jim holtman
Try this chance to actually return values: library(doParallel) Simpar3 - function(n1) { L2distance - matrix(NA, ncol=n1, nrow=n1) data - rnorm(n1) diag(L2distance)=0 cl - makeCluster(4) registerDoParallel(cl) x - foreach(j=1:n1) %dopar% { library(np) datj - data[j]