Rのメモ。
CRANにあるgtoolsのcombinationsとpermutationsがブルートフォースをするときに激しく便利なことに気づいた。ただ、ドコまで効率よくアレイを返してくれるかは調べなければいけないな。
> gtools::combinations(5,3,letters[1:5])
[,1] [,2] [,3]
[1,] "a" "b" "c"
[2,] "a" "b" "d"
[3,] "a" "b" "e"
[4,] "a" "c" "d"
[5,] "a" "c" "e"
[6,] "a" "d" "e"
[7,] "b" "c" "d"
[8,] "b" "c" "e"
[9,] "b" "d" "e"
[10,] "c" "d" "e"
> gtools::permutations(5,3,letters[1:5])
[,1] [,2] [,3]
[1,] "a" "b" "c"
[2,] "a" "b" "d"
[3,] "a" "b" "e"
[4,] "a" "c" "b"
[5,] "a" "c" "d"
[6,] "a" "c" "e"
[7,] "a" "d" "b"
[8,] "a" "d" "c"
[9,] "a" "d" "e"
...