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

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

[Octave-bug-tracker] [bug #50426] perms() yields arbitrary sort order


From: Armin Müller
Subject: [Octave-bug-tracker] [bug #50426] perms() yields arbitrary sort order
Date: Wed, 1 Mar 2017 05:28:27 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0

URL:
  <http://savannah.gnu.org/bugs/?50426>

                 Summary: perms() yields arbitrary sort order
                 Project: GNU Octave
            Submitted by: arm_in
            Submitted on: Wed 01 Mar 2017 10:28:26 AM UTC
                Category: Documentation
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

It might be worth noting in the documentation that the sort order of perms()
is arbitrary. Results may change from version to version, and when switching
from Octave to Matlab or Scilab. M-code that is relying on the sort order will
give different results.

A defensive programming style would be to write something in the form of
"sortrows(perms(xxx), [yyy])"

Example output:

Octave 4.2.0

>> perms(1:3)
ans =

   1   2   3
   2   1   3
   1   3   2
   2   3   1
   3   1   2
   3   2   1

Matlab R2015b

>> perms(1:3)
ans =
     3     2     1
     3     1     2
     2     3     1
     2     1     3
     1     2     3
     1     3     2

Matlab R2016b + R2017a Pr

>> perms(1:3)
ans =
     3     2     1
     3     1     2
     2     3     1
     2     1     3
     1     3     2
     1     2     3





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50426>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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