permorder

0th

Percentile

The order of a permutation

Returns the order of a permutation \(P\): the smallest strictly positive integer \(n\) for which \(P^n\) is the identity.

Usage
permorder(x, singly = TRUE)
Arguments
x

Permutation, coerced to cycle form

singly

Boolean, with default TRUE meaning to return the order of each element of the vector, and FALSE meaning to return the order of the vector itself (that is, the smallest strictly positive integer for which all(x^n==id)).

Details

Coerces its argument to cycle form.

The order of the identity permutation is 1.

Note

Uses mLCM() from the numbers package.

See Also

sgn

Aliases
  • permorder
Examples
# NOT RUN {
x <- rperm(5,20)
permorder(x)
permorder(x,FALSE)

stopifnot(all(is.id(x^permorder(x))))
stopifnot(is.id(x^permorder(x,FALSE)))
# }
Documentation reproduced from package permutations, version 1.0-5, License: GPL-2

Community examples

Looks like there are no examples yet.