# HG changeset patch # User Pedro Angelo # Date 1395171765 10800 # Node ID 1514f5337781afa888af5d12f53815e60f026059 # Parent 03c2671493f932b048b7468dabb6ba60a0eff049 nchoosek.m: nchoosek(N,0) now returns [](1x0) when N is a vector (bug #41890). * nchoosek.m: The help message for nchoosek specifies that if N is a vector, then the number of rows of nchoosek(N,K) must be nchoosek(length(N),K), but the previous implementation was returning a matrix with 0 rows when K==0. Add %!test for new behavior. * contributors.in: Add Pedro Angelo to list of Octave contributors. diff -r 03c2671493f9 -r 1514f5337781 doc/interpreter/contributors.in --- a/doc/interpreter/contributors.in Mon Jun 02 11:17:59 2014 -0700 +++ b/doc/interpreter/contributors.in Tue Mar 18 16:42:45 2014 -0300 @@ -3,6 +3,7 @@ Adam H. Aitkenhead Giles Anderson Joel Andersson +Pedro Angelo Muthiah Annamalai Markus Appel Branden Archer diff -r 03c2671493f9 -r 1514f5337781 scripts/specfun/nchoosek.m --- a/scripts/specfun/nchoosek.m Mon Jun 02 11:17:59 2014 -0700 +++ b/scripts/specfun/nchoosek.m Tue Mar 18 16:42:45 2014 -0300 @@ -109,7 +109,7 @@ warning ("nchoosek", "nchoosek: possible loss of precision"); endif elseif (k == 0) - A = []; + A = zeros (1,0); elseif (k == 1) A = v(:); elseif (k == n) @@ -142,6 +142,7 @@ %!assert (nchoosek (80,10), bincoeff (80,10)) %!assert (nchoosek (1:5,3), [1:3;1,2,4;1,2,5;1,3,4;1,3,5;1,4,5;2:4;2,3,5;2,4,5;3:5]) +%!assert (size (nchoosek (1:5,0)), [1 0]) %% Test input validation %!warning nchoosek (100,45);