|
|
| File Information |
| Description |
ICHOOSE(N,K) gives all combinations of choosing K indices
from the set 1:N without order and without repetitions.
EXAMPLE:
ind = ichoose(4,2);
v = 'ABCD';
v(ind) % ['AB';'AC';'AD';'BC';'BD';'CD']
ICHOOSE is certainly not unique. Here is a comparison with other codes
using TIMEIT by Steve Eddins. Note that VCHOOSEK is a MEX-code.
f1 = @() nchoosek(1:24,8);
f2 = @() combinator(24,8,'c');
f3 = @() ichoose(24,8);
f4 = @() VChooseK(int8(1:24),8);
timeit(f1) % 16.1 sec (NCHOOSEK by MathWorks)
timeit(f2) % 1.17 sec (COMBINATOR by Matt Fig)
timeit(f3) % 0.110 sec (ICHOOSE by Jonas Lundgren)
timeit(f4) % 0.066 sec (VCHOOSEK by Jan Simon)
|
| Acknowledgements |
The author wishes to acknowledge the following in the creation of this submission:
COMBINATOR -combinations AND permutations, VChooseK
|
| MATLAB release |
MATLAB 7.10 (2010a)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 21 Nov 2011 |
New contact info |
|
Contact us at files@mathworks.com