math/
combigen.pro
top source combigen
Math
Generates all possible combinations n-choose-k.
Return value
Returns a M x K array of all K-length combinations of numbers from 0 to N-1.
Parameters
- n in
Maximum number.
- k in
Number of elements in each combination.
Examples
Generate all combinations 5-choose-3:
IDL> print, combigen(5,3)
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
Author information
- History:
Written by Jeremy Bailin 1 April 2011 Initial writing.
File attributes
| Modification date: | Fri Apr 1 15:13:38 2011 |
| Lines: | 64 |
![[attach.png]](../idldoc-resources/attach.png)