Learn R Programming

permutations (version 1.1-5)

outer: Outer product of vectors of permutations

Description

The outer product of two vectors of permutations is the pairwise product of each element of the first with each element of the second.

Arguments

Author

Robin K. S. Hankin

Details

It works in much the same way as base::outer(). The third argument, FUN, as in outer(X,Y,FUN="*") is regular group-theoretic multiplication but can be replaced with + if you are sure that the cycles of X and Y are distinct, see the examples. Each element of the returned matrix is a one-element list.

The print method may have room for improvement.

Examples

Run this code

(M <- outer(rperm(),rperm()))
outer(cyc_len(4) + 0:3, cyc_len(4) + 100:101,"+")  # OK because the cycles are distinct

do.call("c",M) # c(M) gives a list and unlist(a) gives a numeric vector

Run the code above in your browser using DataLab