Re: combination with constraints problem
- From: "Roger Stafford" <ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Jun 2008 01:42:02 +0000 (UTC)
"Harry Kus" <temp@xxxxxxxxxxx> wrote in message <g274m3$hai
$1@xxxxxxxxxxxxxxxxxx>...
.......----------
The function works fine except that it violates the q (upper
limit) constraints.
.......
Yes, you have uncovered another bug, Harry. Sorry about that. The for-
loop line should actually read:
for k = max(N-sum(qt),0):min(N,q(end))
I actually tested this one and it seemed all right in the cases I ran. In your
example, it got your result minus the two fallacious rows with 4's in them. I
also tested it with q's that differed from one another and it seemed to handle
these properly. The function really ought to have a test at least initially to
check whether N <= sum(q) and issue a nasty note if not.
You should beware of long q vectors. These are capable of generating
enormous numbers of combinations.
Roger Stafford
.
- Follow-Ups:
- Re: combination with constraints problem
- From: Harry Kus
- Re: combination with constraints problem
- References:
- combination with constraints problem
- From: Harry Kus
- Re: combination with constraints problem
- From: Roger Stafford
- Re: combination with constraints problem
- From: Roger Stafford
- Re: combination with constraints problem
- From: Harry Kus
- combination with constraints problem
- Prev by Date: Re: Uniformly Distribute Points inside Polygon
- Next by Date: Re: error
- Previous by thread: Re: combination with constraints problem
- Next by thread: Re: combination with constraints problem
- Index(es):
Relevant Pages
|