Hi,
Thanks for your reply and the script.
However, it doesn't work for me if k>2 (Octave 3.2.4)

Martin


----- Mail Original -----
De: "Søren Hauberg" <so...@hauberg.org>
À: "martin ecarnot" <martin.ecar...@free.fr>
Cc: octave-dev@lists.sourceforge.net
Envoyé: Vendredi 26 Novembre 2010 23h07:54 GMT +01:00 Amsterdam / Berlin / 
Berne / Rome / Stockholm / Vienne
Objet: Re: [OctDev] Permutations

Hi

Sorry about the late reply...

fre, 29 10 2010 kl. 11:46 +0200, skrev martin.ecar...@free.fr:
> I've been searching for a function that give all permutations of c elements 
> in n, as "combnk" Matlab function.
> I fund in this forum 
> http://octave.1599824.n4.nabble.com/combinations-td1636272.html a solution 
> using "perms" function.
> However, "perms" function sets a matrix of prod(2:n) line, which limits the 
> use to n=10;
> 
> I tried an empiric algorithme, that can replace the use of "unique(sort 
> (perms (1:n)(:,1:c), 2), 'rows')"
> I am not a mathematician, and not even a programmer, but this code may 
> inspire someone for a "clean" code.

How about the attached implementation of 'combnk' ? I've added this to
the 'statistics' package.

Søren

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to