CALL sla_PERMUT (N, ISTATE, IORDER, J)
N | I | number of items: there will be N! permutations |
| ||
ISTATE | I(N) | state, ISTATE(1) to initialize |
ISTATE | I(N) | state, updated ready for next time |
| ||
IORDER | I(N) | next permutation of numbers 1,2,…,N |
| ||
J | I | status: |
| ||
|
| 1 = illegal N (zero or less is illegal) |
|
||
|
| 0 = OK |
|
||
|
| 1 = no more permutations available |
IORDER(1)=N, IORDER(2)=N-1, ..., IORDER(N)=1
IORDER(1)=1, IORDER(2)=2, ..., IORDER(N)=N