octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65176] unique.m - Enable third output with op


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #65176] unique.m - Enable third output with option 'stable'
Date: Wed, 17 Jan 2024 11:00:32 -0500 (EST)

Update of bug#65176 (group octave):

                  Status:         Patch Submitted => In Progress            

    _______________________________________________________

Follow-up Comment #4:

ok, thanks again for the contribution. Had a chance to test it out and compare
with matlab output.  it seems to work perfectly for vector inputs, but has
issues with array inputs and generates errors when the 'rows' option is used. 


Also, please have a look at the style guideline for m-files (whitespace being
the only real item of note)
https://wiki.octave.org/Octave_style_guide

Here are a few tests that can be added to the file that the patch should try
to address:


%!test <65176>
%! a = [3 2 1 2; 2 1 2 1];
%! [o1, o2, o3] = unique (a);
%! assert ({o1, o2, o3}, {[1;2;3], [4;2;1], [3;2;2;1;1;2;2;1]});
%! [o1, o2, o3] = unique (a, "stable");
%! assert ({o1, o2, o3}, {[3;2;1], [1;2;4], [1;2;2;3;3;2;2;3]});

%!test <65176>
%! a = [3 2 1 2; 2 1 2 1];
%! [o1, o2, o3] = unique (a(1,:), "rows");
%! assert ({o1, o2, o3}, {a(1,:), 1, 1});
%! [o1, o2, o3] = unique (a(1,:), "rows", "stable");
%! assert ({o1, o2, o3}, {a(1,:), 1, 1});
%! [o1, o2, o3] = unique (a, "rows");
%! assert ({o1, o2, o3}, {[a(2,:); a(1,:)], [2;1], [2;1]});
%! [o1, o2, o3] = unique (a, "rows", "stable");
%! assert ({o1, o2, o3}, {a, [1;2], [1;2]});
%! [o1, o2, o3] = unique ([a;a], "rows");
%! assert ({o1, o2, o3}, {[a(2,:); a(1,:)], [2;1], [2;1;2;1]});
%! [o1, o2, o3] = unique ([a;a], "rows", "stable");
%! assert ({o1, o2, o3}, {a, [1;2], [1;2;1;2]});


Also, a complete patch should include a note in the /etc/NEWS.10.md file,
probably under the matlab compatibility section, and a commit message
according to https://wiki.octave.org/Commit_message_guidelines.  

I've updated the status to In Progress, let us know if this is something
you'll have a chance to help address. 


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65176>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]