G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing
Banner Institutions GREYC CNRS ENSICAEN UNICAEN

A Full-Featured Open-Source Framework for Image Processing



Latest stable version: 4.0.4 (2026/08/19)

Reference

Reptorian's Combinatorics Library: Combinations


Description

Combinations are selections of elements where order does not matter.

For example, the sequences { 1,2,3 } and { 3,2,1 } represent
the same combination.

Examples:

rep_ncr_combinations(s)_

Standard combinations where elements are selected
without repetition.

$ +rep_ncr_combinations 5,3 repeat w { e[0] {I[#-1,$>]} }

[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,1,2
[gmic]./ 0,1,3
[gmic]./ 0,1,4
[gmic]./ 0,2,3
[gmic]./ 0,2,4
[gmic]./ 0,3,4
[gmic]./ 1,2,3
[gmic]./ 1,2,4
[gmic]./ 1,3,4
[gmic]./ 2,3,4
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
  size = (10,1,1,3) [120 b of float32].
  data = (0,0,0,0,0,0,1,1,1,2^1,1,1,2,2,3,2,2,3,3^2,3,4,3,4,4,3,4,4,4).
  min = 0, max = 4, mean = 2, std = 1.41421, coords_min = (0,0,0,0), coords_max = (2,0,0,2).
[gmic]./ End G'MIC interpreter.

rep_r_combination(s)_

Combinations with repetition allowed.

$ +rep_r_combinations 4,3 repeat w { e[0] {I[#-1,$>]} }

[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0,0
[gmic]./ 0,0,1
[gmic]./ 0,0,2
[gmic]./ 0,0,3
[gmic]./ 0,1,1
[gmic]./ 0,1,2
[gmic]./ 0,1,3
[gmic]./ 0,2,2
[gmic]./ 0,2,3
[gmic]./ 0,3,3
[gmic]./ 1,1,1
[gmic]./ 1,1,2
[gmic]./ 1,1,3
[gmic]./ 1,2,2
[gmic]./ 1,2,3
[gmic]./ 1,3,3
[gmic]./ 2,2,2
[gmic]./ 2,2,3
[gmic]./ 2,3,3
[gmic]./ 3,3,3
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
  size = (20,1,1,3) [240 b of float32].
  data = (0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,3^0,0,0,0,1,1,1,2,2,3,1,1,1,2,2,3,2,2,3,3^0,1,2,3,1,2,3,2,3,3,1,2,3,2,3,3,2,3,3,3).
  min = 0, max = 3, mean = 1.5, std = 1.11803, coords_min = (0,0,0,0), coords_max = (19,0,0,0).
[gmic]./ End G'MIC interpreter.

Commands

Combinations:

rep_ncr_combinationsrep_ncr_combination_index2list rep_ncr_combination_list2index
 rep_r_combinations  rep_r_combination_index2list   rep_r_combination_list2index

G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing

G'MIC is an open-source software distributed under the CeCILL free software licenses (LGPL-like and/or
GPL-compatible). Copyrights (C) Since July 2008, David Tschumperlé - GREYC UMR CNRS 6072, Image Team.