bugGNU Octave - Bugs: bug #45611, help text for length function...

 
 

bug #45611: help text for length function should describe behavior for n-D arrays, not just 2d matrices

Submitter:  Nicholas Jankowski <nrjank>
Submitted:  Fri 24 Jul 2015 02:37:11 AM UTC
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  Nick Jankowski Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * Microsoft Windows
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Sun 26 Jul 2015 03:18:37 AM UTC, comment #1: 

Changed the documentation for length() to clarify it as you suggested in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/fc23fbe05f3a).  This will be part of the 4.0.1 bug fix release.

Rik <rik5>
Project Administrator
Fri 24 Jul 2015 02:37:11 AM UTC, original submission:  

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.

Nicholas Jankowski <nrjank>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nrjank (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-07-26 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top


    Powered by Savane 3.9