Consider I have really big vector (more then 10 elements), and I have to check some stuff over each permutation, but I don't need all permutations being held in memory. Just for example, for vector with 12 elements I got memory troubles:
>> A = [1 2 3 4 5 6 7 8 9 10 11 12];
>> perms(A)
error: out of memory or dimension too large for Octave's index type
My question is: is any nice and short method to get all possible permutations over vector like iterator, without holding them all in memory, so I could to make them for arbitrary sized vector and do some stuff over each of them in a loop?
Sure I know how to programm this algorithm on any programming language, but I'm looking for ready solution on octave or Matlab.