I have discrete variables a_i=[1 -1]. I need to create a list of all states in system of N variables(# of states = 2^N). Or in other words I have a vector of length N, each component can have two values. How can I generate a list of all possible vectors?
For instance, for 3 variables I need to have
[1 1 1][1 1 -1][1 -1 1][-1 1 1][1 -1 -1][-1 1 -1][-1 -1 1][-1 -1 -1]
Best Answer