i want to know how can we collect two results from two workers that have different dimension fro example an mcmc problem and we save the results in an array the results and we’re using two workers `a=@spawn mcmc(arguments)`

and `b=@spawn mcmc(arguments)`

, how can we combine the two results using `fetch()`

to clarify more suppose that the length of `fetch(a)=50`

elements and the length of `fetch(b)=20`

elements if we use the `+`

we’ll get a dimension mismatch

The simplest method would be to hcat the two arrays. The fastest for lots of simple types of Monte Carlo problems will often be to reduce them separately and combine them using a weighted average (or something similar depending on what your measurement is).

1 Like

can you please clarify the second way or a link where i can understand it

If you were trying to compute the mean for example, it would be `(len(arr1)*mean(arr1)+len(arr2)*mean(arr2))/(len(arr1)+len(arr2))`

1 Like