I need to calculate all $k$-possible subsets$(k:1,L)$ of matrix with size $L$. I am using subset function as following,
L = 10;
Do[
t = L!/(k! (L - k)!);
tstmat = RandomReal[L, {L, L}];
config = Subsets[Range[Length@tstmat], {k}];
Print[{k, t}]
,
{k, 1, L}
];
this is working fine up to $L=24$, but for big sizes I am running into memory issues,
L | mem
25 | 2.152 G
26 | 3.600 G
27 | 6.470 G
28 | 12.418 G
29 | 23.641 G
I am assuming the huge memory is related to part of code where it's calculating the different subsets and keeps all of different configuration, for example for size L=30
and L=40
this becomes on the order of 10^9
and 10^12
sub-lists, respectively. Is there any way to decrease the memory, for example by keeping subsets once at a time? Or maybe is there any other function in Mathematica to calculate the all possible subsets?
Comments
Post a Comment