Tag Info

New answers tagged

0

Here's a simple approach: ParallelTable[With[{g = grab[i]}, If[FreeQ[g, $Failed], g, Nothing]], {i, 2000000, 3000000}] Note: Nothing requires version 10.2


0

How about results=Cases[ ParallelTable[If[!FailedQ[g = grab[i]], g], {i, 2000000, 3000000}],Except[Null]] At some point you'll run into a memory issue with all the Nulls, but I think with only 10^6 you are ok.


1

This may not be the fastest way, but it's a way: SetSharedFunction[ParallelSow] ParallelSow[expr_] := Sow[expr] Reap[ParallelDo[If[countedQ[i], ParallelSow[f[i]]], {i, 1, 10^7}]] where countedQ[i] is some Boolean function that determines whether f[i] gets added to the accumulated list. Feel free to make improvements. Note that AppendTo scales as $O(n^2)$ ...



Top 50 recent answers are included