/* permute.h */ #define TRUE 1 #define FALSE 0 int permute(int n, int vector[], int permuters[]); int permuted(int n, double vector[], int permuters[]); /* CAUTION: N factorial permutations is a bunch for N > 9 The precise definition of a bunch is 3,628,800 up 7! = 5,040 8! = 40,320 9! = 362,880 */ /* INPUT: vector - input and output vector that is permuted This must be set up befor the first call and then used as the next permutation on each return */ /* INIT: permuters[0] != 0 should be = n+1 */ /* OUTPUT: vector - the next permuted vector if_last = 0 if more permutations to be returned = 1 if the last permutation is being returned (done) */