Generate all permutations of v with one row per permutation.
The result has size factorial (n) * n
, where n
is the length of v.
Example
perms ([1, 2, 3]) ⇒ 1 2 3 2 1 3 1 3 2 2 3 1 3 1 2 3 2 1
Programming Note: The maximum length of v should be less than or equal to 10 to limit memory consumption.
See also: permute, randperm, nchoosek.
Package: octave