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: Cartesian Product


Description

The set of all ordered items formed by combining elements
from multiple sets.

You can also view it as enumerating N-dimensional integer
coordinates within bounded ranges, represented as a
1-dimensional sequence.

$ +rep_cartesian_product 2,3,2 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,1,0
[gmic]./ 0,1,1
[gmic]./ 0,2,0
[gmic]./ 0,2,1
[gmic]./ 1,0,0
[gmic]./ 1,0,1
[gmic]./ 1,1,0
[gmic]./ 1,1,1
[gmic]./ 1,2,0
[gmic]./ 1,2,1
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
  size = (12,1,1,3) [144 b of float32].
  data = (0,0,0,0,0,0,1,1,1,1,1,1^0,0,1,1,2,2,0,0,1,1,2,2^0,1,0,1,0,1,0,1,0,1,0,1).
  min = 0, max = 2, mean = 0.666667, std = 0.666667, coords_min = (0,0,0,0), coords_max = (4,0,0,1).
[gmic]./ End G'MIC interpreter.

Commands

Cartesian Product:

rep_cartesian_productrep_cartesian_product_index2listrep_cartesian_product_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.