# allPerm: Generate and return all permutations of a multiset In multicool: Permutations of Multisets in Cool-Lex Order

## Description

This function will return all permutations of a multiset

## Usage

 `1` ```allPerm(mcObj) ```

## Arguments

 `mcObj` an object of class mc - usually generated by `initMC`

## Details

This function will return all permutations of a multiset. It makes no check to see if this is a sensible thing to do. Users are advised to check how many permutations are possible using the `multinom` function in this package.

## Value

A matrix with each row being a different permutation of the multiset

## Note

This function does not warn the user that the requested set of permutations may be very large. In addition, all working is handled entirely in memory, and so this may cause it to crash if the request is execeptionally large.

## Author(s)

James M. Curran

`initMC`, `multinom`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```## a small numeric example with 6 permuations x = c(1,1,2,2) m = initMC(x) allPerm(m) ## a large character example - 60 possibilities x = rep(letters[1:3], 3:1) multinom(x) ## calculate the number of permutations m = initMC(x) allPerm(m) ```

### Example output

```Loading required package: Rcpp
[,1] [,2] [,3] [,4]
[1,]    2    2    1    1
[2,]    1    2    2    1
[3,]    2    1    2    1
[4,]    1    2    1    2
[5,]    1    1    2    2
[6,]    2    1    1    2
[1] 60
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] "c"  "b"  "b"  "a"  "a"  "a"
[2,] "a"  "c"  "b"  "b"  "a"  "a"
[3,] "c"  "a"  "b"  "b"  "a"  "a"
[4,] "b"  "c"  "a"  "b"  "a"  "a"
[5,] "a"  "b"  "c"  "b"  "a"  "a"
[6,] "b"  "a"  "c"  "b"  "a"  "a"
[7,] "c"  "b"  "a"  "b"  "a"  "a"
[8,] "a"  "c"  "b"  "a"  "b"  "a"
[9,] "c"  "a"  "b"  "a"  "b"  "a"
[10,] "a"  "c"  "a"  "b"  "b"  "a"
[11,] "a"  "a"  "c"  "b"  "b"  "a"
[12,] "c"  "a"  "a"  "b"  "b"  "a"
[13,] "b"  "c"  "a"  "a"  "b"  "a"
[14,] "a"  "b"  "c"  "a"  "b"  "a"
[15,] "b"  "a"  "c"  "a"  "b"  "a"
[16,] "a"  "b"  "a"  "c"  "b"  "a"
[17,] "a"  "a"  "b"  "c"  "b"  "a"
[18,] "b"  "a"  "a"  "c"  "b"  "a"
[19,] "c"  "b"  "a"  "a"  "b"  "a"
[20,] "a"  "c"  "b"  "a"  "a"  "b"
[21,] "c"  "a"  "b"  "a"  "a"  "b"
[22,] "a"  "c"  "a"  "b"  "a"  "b"
[23,] "a"  "a"  "c"  "b"  "a"  "b"
[24,] "c"  "a"  "a"  "b"  "a"  "b"
[25,] "a"  "c"  "a"  "a"  "b"  "b"
[26,] "a"  "a"  "c"  "a"  "b"  "b"
[27,] "a"  "a"  "a"  "c"  "b"  "b"
[28,] "c"  "a"  "a"  "a"  "b"  "b"
[29,] "b"  "c"  "a"  "a"  "a"  "b"
[30,] "a"  "b"  "c"  "a"  "a"  "b"
[31,] "b"  "a"  "c"  "a"  "a"  "b"
[32,] "a"  "b"  "a"  "c"  "a"  "b"
[33,] "a"  "a"  "b"  "c"  "a"  "b"
[34,] "b"  "a"  "a"  "c"  "a"  "b"
[35,] "a"  "b"  "a"  "a"  "c"  "b"
[36,] "a"  "a"  "b"  "a"  "c"  "b"
[37,] "a"  "a"  "a"  "b"  "c"  "b"
[38,] "b"  "a"  "a"  "a"  "c"  "b"
[39,] "c"  "b"  "a"  "a"  "a"  "b"
[40,] "b"  "c"  "b"  "a"  "a"  "a"
[41,] "b"  "b"  "c"  "a"  "a"  "a"
[42,] "a"  "b"  "b"  "c"  "a"  "a"
[43,] "b"  "a"  "b"  "c"  "a"  "a"
[44,] "b"  "b"  "a"  "c"  "a"  "a"
[45,] "a"  "b"  "b"  "a"  "c"  "a"
[46,] "b"  "a"  "b"  "a"  "c"  "a"
[47,] "a"  "b"  "a"  "b"  "c"  "a"
[48,] "a"  "a"  "b"  "b"  "c"  "a"
[49,] "b"  "a"  "a"  "b"  "c"  "a"
[50,] "b"  "b"  "a"  "a"  "c"  "a"
[51,] "a"  "b"  "b"  "a"  "a"  "c"
[52,] "b"  "a"  "b"  "a"  "a"  "c"
[53,] "a"  "b"  "a"  "b"  "a"  "c"
[54,] "a"  "a"  "b"  "b"  "a"  "c"
[55,] "b"  "a"  "a"  "b"  "a"  "c"
[56,] "a"  "b"  "a"  "a"  "b"  "c"
[57,] "a"  "a"  "b"  "a"  "b"  "c"
[58,] "a"  "a"  "a"  "b"  "b"  "c"
[59,] "b"  "a"  "a"  "a"  "b"  "c"
[60,] "b"  "b"  "a"  "a"  "a"  "c"
```

multicool documentation built on May 30, 2017, 5:51 a.m.