end
To avoid data-racing, in each iteration m, we stored epsim12 into epsim_cell, and compute f using another for loop. Using parfor on a 12-cores machine gives a four time speed up for computing msmf_corr_coeff.m (apology for not having a profiling screenshot here). Note that the actual speedup depends how many cores you are using.For the same R, monte_M, and mktsize, it now takes ~ 35 seconds to finish one call to msmf_corr_coeff. [[msmf_corr_coeff_speedup.png]]