Mercurial > octave
changeset 33664:28493b96c69f bytecode-interpreter
maint: Merge default to bytecode-interpreter
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Fri, 14 Jun 2024 15:14:13 -0400 |
parents | cc62e18e0519 (current diff) b2af12232f75 (diff) |
children | |
files | |
diffstat | 2 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/NEWS.10.md Fri Jun 14 13:00:50 2024 -0400 +++ b/etc/NEWS.10.md Fri Jun 14 15:14:13 2024 -0400 @@ -79,6 +79,9 @@ the cell array, matching Matlab behavior. Previously, Octave's conversion from non-integers to integers was more lenient. +- `issorted` now accepts the MODE option "monotonic", which has the same + behavior as the option "either". + ### Alphabetical list of new functions added in Octave 10 * `clim`
--- a/libinterp/corefcn/data.cc Fri Jun 14 13:00:50 2024 -0400 +++ b/libinterp/corefcn/data.cc Fri Jun 14 15:14:13 2024 -0400 @@ -7476,10 +7476,10 @@ smode = ASCENDING; else if (mode == "descend") smode = DESCENDING; - else if (mode == "either") + else if (mode == "either" || mode == "monotonic") smode = UNSORTED; else - error (R"(issorted: MODE must be "ascend", "descend", or "either")"); + error (R"(issorted: MODE must be "ascend", "descend", "monotonic", or "either")"); return smode; } @@ -7490,7 +7490,9 @@ @deftypefnx {} {@var{tf} =} issorted (@var{A}, @var{mode}) @deftypefnx {} {@var{tf} =} issorted (@var{A}, "rows", @var{mode}) Return true if the vector @var{A} is sorted according to @var{mode}, which -may be either @qcode{"ascend"}, @qcode{"descend"}, or @qcode{"either"}. +may be either @qcode{"ascend"}, @qcode{"descend"}, @qcode{"either"}, or +@qcode{"monotonic"} (@qcode{"either"} and @qcode{"monotonic"} are +equivalent). By default, @var{mode} is @qcode{"ascend"}. NaNs are treated in the same manner as @code{sort}. @@ -7583,6 +7585,12 @@ %!assert (issorted (fliplr (sv), "either")) %!assert (issorted (sv', "either")) %!assert (issorted (fliplr (sv)', "either")) +%!assert (issorted (sm, "rows", "monotonic")) +%!assert (issorted (flipud (sm), "rows", "monotonic")) +%!assert (issorted (sv, "either")) +%!assert (issorted (fliplr (sv), "monotonic")) +%!assert (issorted (sv', "either")) +%!assert (issorted (fliplr (sv)', "monotonic")) %!assert (issorted ([])) %!assert (issorted ([], "rows"))