sgn

0th

Percentile

Sign of a permutation

The sign of a permutation is \(\pm 1\) depending on whether it is even or odd

Usage
sgn(x)
is.even(x)
is.odd(x)
Arguments
x

permutation object

Details

Coerces to cycle form

See Also

shape

Aliases
  • sgn
  • is.even
  • is.odd
Examples
# NOT RUN {
sgn(id)  # always problematic

sgn(rperm(10,5))

x <- rperm(40,6)
y <- rperm(40,6)


stopifnot(all(sgn(x*y) == sgn(x)*sgn(y)))   # sgn() is a homomorphism


z <- as.cycle(rperm(20,9,5))
z[is.even(z)]
z[is.odd(z)]

# }
Documentation reproduced from package permutations, version 1.0-5, License: GPL-2

Community examples

Looks like there are no examples yet.