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

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

[Octave-bug-tracker] [bug #45611] help text for length function should d


From: Nick Jankowski
Subject: [Octave-bug-tracker] [bug #45611] help text for length function should describe behavior for n-D arrays, not just 2d matrices
Date: Fri, 24 Jul 2015 02:37:12 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0

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

                 Summary: help text for length function should describe
behavior for n-D arrays, not just 2d matrices
                 Project: GNU Octave
            Submitted by: nrjank
            Submitted on: Fri 24 Jul 2015 02:37:11 AM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Documentation
                  Status: None
             Assigned to: None
         Originator Name: Nick Jankowski
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

minor detail, but it confused me for a second. Looking at the help text for
the length function, it states:  

"...For matrix objects, the length is the number of rows or columns, whichever
is greater (this odd definition is used for compatibility with MATLAB)."

in both Octave and ML the behavior of the function is to give max(size(A)). 
This carries through for n-dimensional arrays as well, so a dim3 vector
(1x1xn) will return 'n'.  I would recommend a help text change to something
like the following to be more generic:

"
... to maintain MATLAB compatibility, the length for matrix and n-dimensional
array objects is the number of elements in the longest dimension, such that
length(A) is equivalent to max(size(A)).

@example
A = ones(3,7,2);
length(A)
  ==> ans = 7
@end example

"

I did see bug #45138 about documenting the different behavior of length. Might
be worth the explicit dimension if its usage elsewhere is usually different.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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