octave-maintainers
[Top][All Lists]
Advanced

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

combining nchoosek with bincoeff


From: Francesco Potortì
Subject: combining nchoosek with bincoeff
Date: Wed, 26 Nov 2008 16:08:18 +0100

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: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

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