octave-maintainers
[Top][All Lists]
Advanced

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

Re: combining nchoosek with bincoeff


From: David Bateman
Subject: Re: combining nchoosek with bincoeff
Date: Fri, 28 Nov 2008 23:56:37 +0100
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)

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                                address@hidden
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)



reply via email to

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