Thanks Matt! Now I got it.
For small arrays, this function is faster than your COMBINATOR.
H1-Line, help, example, contact address, "see also", input checks, extensive comments, works correct and efficiently => nice for teaching and computing!
5
17 Dec 2009
N_PERMUTE_K
All possible permutations of the elements of set N, taken K at a time, with repetition.
Jan,
With the single class we are ok up to 16,000,000 elements. Even finding the number taken two at a time would lead to an array of size 5.12e+014 elements. I think this is beyond the reasonable, even with 64-bit computing! The other problem is that cumsum isn't supported for the integer classes, at least in 2007b. If you look at my COMBINATOR file, you will see that I have included a MEX which performs cumsum on integer classes.
Thanks.
Comment only
17 Dec 2009
N_PERMUTE_K
All possible permutations of the elements of set N, taken K at a time, with repetition.
Why is the index IDX a SINGLE array, if N is a SINGLE? Isn't this an unnecessary limitation when working with large arrays on a 64-bit Matlab? UINT32 would accept larger arrays with using all 32 bits for adressing. And addressing with UINT32 might be faster than with SINGLEs (depending on Matlab version?!).
--- But of course: The number of permutations will explode at far smaller limits, I know.
Is it helpful to cast CHAR to DOUBLEs temporarily, or would it be better to store them in smaller INT16?
Comment only