Sow和Reap无法与ParallelDo联用?
mathematica吧
全部回复
仅看楼主
吧务
level 15
xzcyr
楼主
……总之算是把自带的教程稀里糊涂啃了一遍,然后开始试验,可是第一个例子就碰壁了:
Reap@Do[Sow[i++], {i, 10}]
Reap@ParallelDo[Sow[i++], {i, 10}]
期望中的结果当然是两者一样,但是第2个只能获得一个空列表。
这里的i好像也不存在要分配变量的问题。(实际上分配了之后也没变化……)有人知道怎么回事吗?
2013年10月24日 15点10分
1
吧务
level 15
xzcyr
楼主
找到了:
http://blog.wolfram.com/2011/04/20/mathematica-qa-sow-reap-and-parallel-programming/
http://mathematica.stackexchange.com/questions/33395/parallelmap-and-sow-reap-not-behaving-as-expected
http://mathematica.stackexchange.com/questions/313/how-to-collect-result-continuously-interruptible-calculation-when-running-para
2013年10月25日 03点10分
2
1