combining nchoosek with bincoeff
Francesco Potortì
Potorti at isti.cnr.it
Wed Nov 26 09:08:18 CST 2008
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.
--
Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa Email: Potorti at isti.cnr.it
(entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/
More information about the Octave-maintainers
mailing list