Reptorian's Combinatorics Library: Permutations
Description
Permutations are ordered arrangements of elements where order matters.For example, the sequences { 1,2,3 } and { 3,2,1 } are two different
permutations of the same elements.
Examples:
rep_permutation(s)_
Standard permutations where all elements are distinctand each element is used exactly once.
$ +rep_permutations 3 repeat w { e[0] {I[#-1,$>]} }
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,1,2
[gmic]./ 0,2,1
[gmic]./ 1,0,2
[gmic]./ 1,2,0
[gmic]./ 2,0,1
[gmic]./ 2,1,0
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (6,1,1,3) [72 b of float32].
data = (0,0,1,1,2,2^1,2,0,2,0,1^2,1,2,0,1,0).
min = 0, max = 2, mean = 1, std = 0.816497, coords_min = (0,0,0,0), coords_max = (4,0,0,0).
[gmic]./ End G'MIC interpreter.
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,1,2
[gmic]./ 0,2,1
[gmic]./ 1,0,2
[gmic]./ 1,2,0
[gmic]./ 2,0,1
[gmic]./ 2,1,0
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (6,1,1,3) [72 b of float32].
data = (0,0,1,1,2,2^1,2,0,2,0,1^2,1,2,0,1,0).
min = 0, max = 2, mean = 1, std = 0.816497, coords_min = (0,0,0,0), coords_max = (4,0,0,0).
[gmic]./ End G'MIC interpreter.
rep_npr_permutation(s)_
Permutations where only a subset of elements is selectedfrom a larger set. Each element may appear at most once.
$ +rep_npr_permutations 4,2 repeat w { e[0] {I[#-1,$>]} }
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 0,3
[gmic]./ 1,0
[gmic]./ 1,2
[gmic]./ 1,3
[gmic]./ 2,0
[gmic]./ 2,1
[gmic]./ 2,3
[gmic]./ 3,0
[gmic]./ 3,1
[gmic]./ 3,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (12,1,1,2) [96 b of float32].
data = (0,0,0,1,1,1,2,2,2,3,3,3^1,2,3,0,2,3,0,1,3,0,1,2).
min = 0, max = 3, mean = 1.5, std = 1.11803, coords_min = (0,0,0,0), coords_max = (9,0,0,0).
[gmic]./ End G'MIC interpreter.
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 0,3
[gmic]./ 1,0
[gmic]./ 1,2
[gmic]./ 1,3
[gmic]./ 2,0
[gmic]./ 2,1
[gmic]./ 2,3
[gmic]./ 3,0
[gmic]./ 3,1
[gmic]./ 3,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (12,1,1,2) [96 b of float32].
data = (0,0,0,1,1,1,2,2,2,3,3,3^1,2,3,0,2,3,0,1,3,0,1,2).
min = 0, max = 3, mean = 1.5, std = 1.11803, coords_min = (0,0,0,0), coords_max = (9,0,0,0).
[gmic]./ End G'MIC interpreter.
rep_r_permutation(s)_
Permutations with repetition allowed, where elementsmay appear multiple times.
$ +rep_r_permutations 3,2 repeat w { e[0] {I[#-1,$>]} }
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 1,0
[gmic]./ 1,1
[gmic]./ 1,2
[gmic]./ 2,0
[gmic]./ 2,1
[gmic]./ 2,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (9,1,1,2) [72 b of float32].
data = (0,0,0,1,1,1,2,2,2^0,1,2,0,1,2,0,1,2).
min = 0, max = 2, mean = 1, std = 0.816497, coords_min = (0,0,0,0), coords_max = (6,0,0,0).
[gmic]./ End G'MIC interpreter.
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 1,0
[gmic]./ 1,1
[gmic]./ 1,2
[gmic]./ 2,0
[gmic]./ 2,1
[gmic]./ 2,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (9,1,1,2) [72 b of float32].
data = (0,0,0,1,1,1,2,2,2^0,1,2,0,1,2,0,1,2).
min = 0, max = 2, mean = 1, std = 0.816497, coords_min = (0,0,0,0), coords_max = (6,0,0,0).
[gmic]./ End G'MIC interpreter.


Home
Download
News
Mastodon
Bluesky
X
Summary - 18 Years
Summary - 17 Years
Summary - 16 Years
Summary - 15 Years
Summary - 13 Years
Summary - 11 Years
Summary - 10 Years
Resources
Technical Reference
Scripting Tutorial
Video Tutorials
Wiki Pages
Image Gallery
Color Presets
Using libgmic
G'MIC Online
Community
Discussion Forum (Pixls.us)
GimpChat
IRC
Report Issue