Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sgn

Sign of a permutation


Description

The sign of a permutation is +/-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

Author(s)

Robin K. S. Hankin

See Also

Examples

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)]

permutations

The Symmetric Group: Permutations of a Finite Set

v1.0-9
GPL-2
Authors
Robin K. S. Hankin [aut, cre] (<https://orcid.org/0000-0001-5982-0415>), Paul Egeler [ctb] (<https://orcid.org/0000-0001-6948-9498>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.