[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Why must k be less than n in a multiset?

From: Michael Underwood
Subject: [Help-gsl] Why must k be less than n in a multiset?
Date: Thu, 8 Sep 2011 15:18:39 -0600


I'm trying to create all multisets of length k=3 on sets of the form
{1,...,n}, where n ranges from 1 to 9. So for n=1 I would expect to
get only the multiset {{1,1,1}}; for n=2 I'd get {{1,1,1}}, {{1,1,2}},
{{1,2,2}}, and {{2,2,2}}. However, when I call gsl_multiset_calloc(n,
3) with n<3, I receive the run-time error:

> gsl: init.c:42: ERROR: multiset length k must be an integer less than or 
> equal to n
> Default GSL error handler invoked.
> Abort trap

I looked at line 42 in init.c, and it simply throws that error message
inside an "if (k>n)" block, which doesn't really explain why the check
is in place. I haven't looked further into the GSL source than that

So my questions are (1) does anybody know why there is a check to
ensure k<=n when this is not required of a multiset, and (2) what is
the best way to obtain the behaviour I'm after, hopefully without
having to rewrite existing code that works for n=3 to 9 (and
presumably higher)?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]