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

Submitted by:  Nicholas Jankowski <nrjank>
Submitted on:  Fri 24 Jul 2015 02:37:11 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Documentation
Status: FixedAssigned to: None
Originator Name: Nick JankowskiOpen/Closed: Closed
Release: 4.0.0Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 26 Jul 2015 03:18:37 AM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1