[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nchoosek question
From: |
Mike Miller |
Subject: |
Re: nchoosek question |
Date: |
Fri, 9 Dec 2005 12:01:57 -0600 (CST) |
On Fri, 9 Dec 2005, Frank Palazzolo wrote:
I am using nchoosek(n,k) to generate the number of combinations
n!/(k!(n-k)!).
Unfortunately, it seems there is no vectorized version, for n and k are
vectors or matrices of the same size.
It looks like bincoeff(N,k) does what you want.
bincoeff( reshape( [10:2:20]', 3, 2 ), reshape( [5:10]', 3, 2 ) )
ans =
252 12870
924 48620
3432 184756
Should we do away with nchoosek()? Alias it to bincoeff()?
Mike
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------