Some time ago I asked the following question:
I was easily answered and I was satisfied by the answer. However in computing such combinatorics, I saturated the RAM very easily, both in my computer and in a cluster.
I would like to know if there is a way to save the output coming from Distribute while Mathematica is running maybe in different files (one for component, I was thinking, but maybe there is also some more sophisticated way), so that it does not occupy the RAM and I can later call part of the output when I need it, and the RAM saturation should be solved.
I'm also open to the possibility that there're other ways to store the large output coming from Distribute (or equivalent) so that I can actually do the computation without problem.
Outer,Tuples, orDistributefrom the other answer, you just bloat your memory without getting any further bit of information. Why don't you appreciate that the data was seemingly well compressed in the first place? My suffestions: Find a way to generate small chunks of the uncompressed data from the compressed one as needed. – Henrik Schumacher Feb 27 '20 at 20:57PositionIndexas dictionary). Then you have the chance to work with packed arrays which can be stored and processed very efficiently. Plus, you can employCompileto speed up procedures on your data. – Henrik Schumacher Feb 27 '20 at 21:04That said, I have the same feeling as Henrik that this may be an X-Y question: What precisely is the end game here? Are you generating some combinatorial structure and then counting members that meet some criteria? If so, why not just do it directly using combinatorial means?
– ciao Feb 28 '20 at 08:21