# nchoosekFS

nchoosekFS returns the Binomial coefficient or matrix containing all combinations

## Description

c =nchoosekFS(v, k) Binomial coefficient(s) or all combinations.

## Examples

expand all

### Binomial coefficient(s) or all combinations.

Profile generation of 2118760 combinations.

v = 1:50; k = 4;
tic
for i=1:10, nchoosekFS(v,k); end
t_nchoosekFS = toc
tic
for i=1:10, nchoosek(v,k); end
t_nchoosek = toc
fprintf('nchoosekFS has been %5.2f times faster than nchoosek\n\n\n', t_nchoosek/t_nchoosekFS);
fprintf('Try now again using k=5: in a 32 bit computer\n');
fprintf('nchoosekFS will require about the same time (in order of magnitude)\n');
fprintf('while nchoosek will start swaping into virtual memory.\n');
t_nchoosekFS =

0.0422

t_nchoosek =

0.2128

nchoosekFS has been  5.05 times faster than nchoosek

Try now again using k=5: in a 32 bit computer
nchoosekFS will require about the same time (in order of magnitude)
while nchoosek will start swaping into virtual memory.

## Input Arguments

### v — Vector of length n. Integer or array of non-negative integers.

Data Types: single|double

### k — Items to choose from the set of n elements. Non negative integer.

Data Types: single|double

## References

Riordan, J. (1958), "An Introduction to Combinatorial Analysis", Wiley & Sons, New York.