[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek fo
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility |
Date: |
Fri, 24 Sep 2021 17:08:16 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 |
Follow-up Comment #22, bug #61199 (project octave):
@nrjank: For extended documentation on the BIST system see Appendix B Test and
Demo Functions in the Octave manual. It covers the various forms and how to
use the conditionals like %!testif, etc.
I find it fascinating that this particular function has been in Octave for
years, and is suddenly undergoing a great deal of improvement.
I checked in @nrjank's changeset to allow struct array inputs. I did change
the BIST test because the k==2 code was not getting tested because k==n elseif
branch was being hit first. I simply expanded the struct array to 3 elements
in order to get this to work.
diff -r 281ab99062cf scripts/specfun/nchoosek.m
--- a/scripts/specfun/nchoosek.m Thu Sep 23 21:06:41 2021 -0400
+++ b/scripts/specfun/nchoosek.m Fri Sep 24 14:00:51 2021 -0700
@@ -228,16 +228,17 @@ endfunction
%! s.a = [1 2 3];
%! s.b = [4 5 6];
%! s(2).a = 1; # make s a struct array rather than scalar struct
+%! s(3).b = 2; # make s at least three elements for k == 2 test below
%! x = nchoosek (s, 0);
%! assert (size (x), [1, 0]);
%! assert (isstruct (x));
%! assert (fieldnames (x), {"a"; "b"});
%! x = nchoosek (s, 2);
-%! assert (size (x), [1, 2]);
+%! assert (size (x), [3, 2]);
%! assert (isstruct (x));
%! assert (fieldnames (x), {"a"; "b"});
-%! x = nchoosek (s, 3);
-%! assert (size (x), [0, 3]);
+%! x = nchoosek (s, 4);
+%! assert (size (x), [0, 4]);
%! assert (isstruct (x));
%! assert (fieldnames (x), {"a"; "b"});
Final changeset is here:
http://hg.savannah.gnu.org/hgweb/octave/rev/54774a713d7c
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61199>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, (continued)
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Rik, 2021/09/23
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Nicholas Jankowski, 2021/09/23
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, John W. Eaton, 2021/09/23
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Rik, 2021/09/23
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Nicholas Jankowski, 2021/09/23
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Nicholas Jankowski, 2021/09/23
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, John W. Eaton, 2021/09/23
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Philip Nienhuis, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility,
Rik <=
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Rik, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Rik, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, John W. Eaton, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, anonymous, 2021/09/24
- [Octave-bug-tracker] [bug #61199] Allow 'char' input sets to nchoosek for Matlab compatibility, Rik, 2021/09/24