[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nchoosek
From: |
Daniel J Sebald |
Subject: |
Re: nchoosek |
Date: |
Mon, 01 Sep 2014 00:51:19 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 08/31/2014 08:35 PM, Rik wrote:
On 08/31/2014 09:00 AM, address@hidden wrote:
Le 31/08/2014 05:43, Rik a écrit :
[snip]
However, when the first input is a vector, the input is treated as a set.
nchoosek returns all possible subsets of the original set which have the
desired property of being a unique combination of the original elements in
groups of k.
nchoosek ([4 5], 8)
is not
[ nchoosek(4, 8), nchoosek(5,8) ]
so I don't think it should return [0, 0].
Plus, if it did return [0 0] then there would be a non-unique output because
octave-cli:1> nchoosek([0 0], 2)
ans =
0 0
Interpreting the behavior based upon vector/scalar has always been a
dodgy method because of the inherent restrictions it imposes.
Right now we return the empty set, which is true because that is the only
subset that matches. I do find it odd that we give an error in the first
case and not in the second. If I had to vote I would change the first case
to return 0 since that is close to the second case of returning the empty
set [].
Julien, you mentioned commonly using nchoosek-like functions for k
outside the range [0 N]. Can you give an example? And what if k is
negative? Error or 0?
Dan
- Re: nchoosek, Julien Bect, 2014/09/01
- Re: nchoosek,
Daniel J Sebald <=