allperms {permutations} | R Documentation |
All permutations of a given size and all cycles of a given length
Description
Function allperms()
returns all \(n\) factorial permutations
of a set. Function allcyc()
returns all \((n-1)!\)
permutations comprising a single cycle of length \(n\).
Usage
allperms(n)
allcyc(n)
Arguments
n |
The size of the set, integer |
Details
Function allperms()
is very basic (the idiom is
word(t(partitions::perms(n)))
) but is here for completeness.
Note
Function allcyc()
is taken directly from Er's
“fine-tuned” algorithm. It should really be implemented in
C as part of the partitions package but I have not
yet got round to this.
Author(s)
Robin K. S. Hankin
References
M. C. Er 1989 “Efficient enumeration of cyclic permutations in situ”. International Journal of Computer Mathematics, volume 29:2-4, pp121-129.
See Also
Examples
allperms(5)
allcyc(5)
[Package permutations version 1.1-2 Index]