Functions word()
and cycle()
are rather formal functions
which make no attempt to coerce their arguments into sensible forms.
The user should use permutation()
, which detects the form of the
input and dispatches to as.word()
or as.cycle()
, which
are much more user-friendly.
Functions word()
and cycle()
are the only functions in the
package which assign class word
or cycle
to an
object.
A word is a matrix whose rows correspond to permutations in word
format.
A cycle is a list whose elements correspond to permutations in
cycle form. A cycle
object comprises elements which are
informally dubbed ‘cyclists’. A cyclist is a list of integer
vectors corresponding to the cycles of the permutation.
Function cycle2word()
converts cycle objects to word objects.
Function shift_cycle()
is a convenience wrapper for
as.cycle(seq_len(n))
; cyc_len()
is a synonym.
It is a very common error (at least, it is for me) to use cycle()
when you meant as.cycle()
.
The print method is sensitive to the value of option
‘print_word_as_cycle
’, documented at print.Rd
.
Function as.matrix.word()
coerces a vector of permutations in word form to
a matrix, each row of which is a word. To get a permutation matrix (that is, a
square matrix of ones and zeros with exactly one entry of 1 in each row and each column),
use perm_matrix()
.