combining nchoosek with bincoeff
David Bateman
dbateman at dbateman.org
Fri Nov 28 16:56:37 CST 2008
Francesco Potortì wrote:
> The nchoosek source contains this comment:
>
> ## FIXME -- This function is identical to bincoeff for scalar
> ## values, and so should probably be combined with bincoeff.
>
> However, the two functions behave differently even for scalar values:
>
> - nchoosek only works for integer values, and is very fast
> - bincoeff works for real values, and can handle big numbers without
> allocating much memory
>
> So I see two changes to be done:
>
> 1) nchoosek should check for integer input scalar values, and either
> a) barf if not integer or
> b) call bincoeff to give a correct result
> 2) bincoeff could check for integer arguments and use the different,
> faster algorithm of nchoosek in this case
>
> I can make all or part of these changes, if people think they are
> allright.
>
> At least 1a) should be implemented, in my opinion, and the FIXME comment
> removed.
>
>
From the above it seems to me you're saying that in fact bincoeff and
nchoosek in fact have significant differences. I'd say make change 1a)
and remove the fixme.. Do you want to update your nchoosek changeset,
and I'll apply it..
D.
--
David Bateman dbateman at dbateman.org
35 rue Gambetta +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)
More information about the Octave-maintainers
mailing list