Learn R Programming

permutations (version 1.1-5)

shape: Shape of a permutation

Description

Returns the shape of a permutation. If given a word, it coerces to cycle form.

Usage

shape(x, drop = TRUE,id1 = TRUE,decreasing = FALSE)
shape_cyclist(cyc,id1=TRUE)
padshape(x, drop = TRUE, n=NULL)
shapepart(x)
shapepart_cyclist(cyc,n=NULL)

Value

Function shape() returns a list with elements representing the lengths of the component cycles.

Function shapepart() returns an object of class

partition showing the permutation as a set partition of disjoint cycles.

Function padshape() returns a list of shapes but padded with ones so the total is the size of the permutation.

shapepart_cyclist() and shapepart_cyclist() are low-level helper functions.

Arguments

x

Object of class cycle (if not, coerced)

cyc

A cyclist

n

Integer governing the size of the partition assumed, with default NULL meaning to use the largest element

drop

Boolean, with default TRUE meaning to unlist if possible

id1

Boolean, with default TRUE in function shape_cyclist() meaning that the shape of the identity is “1” and FALSE meaning that the shape is NULL

decreasing

In function shape(), Boolean with default FALSE meaning to return the cycle lengths in the order given by nicify_cyclist() and TRUE meaning to sort in decreasing order

Author

Robin K. S. Hankin

See Also

size,conjugate

Examples

Run this code

jj <- as.cycle(c("123","","(12)(34)","12345"))
jj
shape(jj)

shape(rperm(10,9)) # coerced to cycle

a <- rperm()
identical(shape(a,dec=TRUE),shape(a^cyc_len(2),dec=TRUE))


data(megaminx)
shape(megaminx)

jj <- megaminx*megaminx[1]
identical(shape(jj),shape(tidy(jj)))  #tidy() does not change shape


allperms(3)
shapepart(allperms(3))
shapepart(rperm(10,5))

shape_cyclist(list(1:4,8:9))
shapepart_cyclist(list(1:4,8:9))

Run the code above in your browser using DataLab