bugGNU Octave - Bugs: bug #45138, Document difference between...

 
 

bug #45138: Document difference between Matrix::length() and interpreter length function

Submitter:  Piotr Held <jsoh425>
Submitted:  Tue 19 May 2015 01:30:09 AM UTC
   
 
Category:  Documentation Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Jsoh425 Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 02 Jun 2015 04:51:26 PM UTC, comment #8: 

Retagging release from 4.0.0-rc4 to 4.0.0.

John W. Eaton <jwe>
Group administrator
Thu 21 May 2015 05:40:21 PM UTC, comment #7: 

Sorry, I didn't notice the second patch. I have pushed after a few changes. Also, doxygen should use @ instead of / for commands, e.g., @c and @note instead of /c and /note. The idea is to be closer to texinfo. Thank you

Carnë Draug <carandraug>
Group Member
Thu 21 May 2015 02:27:51 PM UTC, comment #6: 

@Mike thanks for doing all that for me, next time I will endeavor to do bettter.

@Carne I submitted two patches one that adds a note to Array.h (length.diff) and one that edits external.txi (external.diff).

Are there any other actions that could be taken to make this more apparent to the user?

Piotr Held <jsoh425>
Thu 21 May 2015 12:13:25 AM UTC, comment #5: 

On his defence, savannah is specially bad in the aspect that attaching a patch does not trigger a comment on the discussion.

Anyway, about the patch, I had forgotten we have an introduction to liboctave on the appendix of the manual. Maybe we should reference doxygen there instead.

I don't think the attached patch is appropriate. The section on the manual is a very short introduction, and it doesn't reference length() which is the source of confusion. The note on this place would only cause problem. This note would be appropriate on Array.h instead, the place where people would Array::length().

Carnë Draug <carandraug>
Group Member
Wed 20 May 2015 11:17:25 PM UTC, comment #4: 

So it looks like you want to repurpose this bug report for a documentation patch.

For future reference, it would be best to explicitly ask that this be reopened and the topic be updated.

Also for future reference, please add a comment to the "Discussion" section of the report when you attach a patch, otherwise it may get lost and forgotten at the bottom of the report.

I happened to notice the email, I'm taking the liberty of reopening, retitling, and updating the status for you.

Mike Miller <mtmiller>
Group Member
Wed 20 May 2015 04:02:10 AM UTC, comment #3: 

Sure I will do that tomorrow.

Piotr Held <jsoh425>
Tue 19 May 2015 07:57:42 PM UTC, comment #2: 

Might be worth to note this discrepancy in the C++ headers files. Piotr, could you supply a patch that documents this (doxygen)?

Carnë Draug <carandraug>
Group Member
Tue 19 May 2015 01:37:08 PM UTC, comment #1: 

Thanks for looking into this. Yes, this is intentional. The length method for an Octave Array or Matrix class is the same as the numel method, i.e. the total number of elements in the container.

For compatibility with Matlab, the length function in the interpreter is the size of the largest dimension only.

Mike Miller <mtmiller>
Group Member
Tue 19 May 2015 01:30:09 AM UTC, original submission:  

I am writing this because there is a discrepancy between how length() works in Octave and how it works in m-files. This might be intentional, but I still wanted to bring it up.


#include <octave/oct.h>

DEFUN_DLD (wrng, args, ,"" )
{
  octave_value_list retval;
  Matrix a (5,2);
  retval(0) = a.length();
  return retval;
}


In the spirit of how Octave interprets length () in function wrng() that is above should return 5, but in fact it return 10 (all of the elements of 'a').

Piotr Held <jsoh425>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34063:  external.diff added by jsoh425 (1KiB - text/x-patch - The external.diff contains modifications to doc/interpreter/external.txi to make a clear note that Array::length() is different from length() called in the interpreter. The other file (length.diff) has the fixes to the Array class headers.)
file #34064:  length.diff added by jsoh425 (2KiB - text/x-patch - The external.diff contains modifications to doc/interpreter/external.txi to make a clear note that Array::length() is different from length() called in the interpreter. The other file (length.diff) has the fixes to the Array class headers.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jsoh425 (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 group members can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-06-02 jwe Release4.0.0-rc4 4.0.0
    2015-05-21 carandraug StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2015-05-20 mtmiller CategoryOctave Function Documentation
        Severity3 - Normal 2 - Minor
        Item GroupIncorrect Result Other
        StatusInvalid / Not an Octave Bug Patch Submitted
        Open/ClosedClosed Open
        SummaryCalling length() on a matrix gives wrong result. Document difference between Matrix::length() and interpreter length function
    2015-05-20 jsoh425 Attached File- Added external.diff, #34063
        Attached File- Added length.diff, #34064
    2015-05-19 mtmiller StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code