bugGNU Octave - Bugs: bug #47469, sizemax() is off by one

 
 

bug #47469: sizemax() is off by one

Submitted by:  CarnĂ« Draug <carandraug>
Submitted on:  Sat 19 Mar 2016 07:07:59 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 30 Mar 2016 10:50:13 AM UTC, comment #1:

I suggest to deprecate "sizemax" and remove "dim_vector::dim_max". Or is there any non-obvious benefit from it?

1. The function name is misleading. "numelmax" or alike would be more applicable, as it gives the information, how many elements an array can index. The misleading idea is, that something like

was okay. I think in bug #47468 the intention is to use it in test code, what I think is a bad idea, to start relying on this function.

2. The information of 64-bit indices for the user is implicitly given by

3. The only "real" usage is in scripts/sparse/private/__sprand__.m, but after diving into that code, it is only part of a dirty hack, that should be solved in the randperm() function.

Kai Torben Ohlhus <siko1056>
Project Member
Sat 19 Mar 2016 07:07:59 PM UTC, original submission:

The function sizemax() is off by one.

The fact that I can create that array of ones is a separate bug (see bug #47468). The reason for being off by one is mentioned in the source of dim-vector:

http://hg.savannah.gnu.org/hgweb/octave/file/2cdbae31c022/liboctave/array/dim-vector.cc#l32

Checking the logs for a better explanation brings up this:

http://hg.savannah.gnu.org/hgweb/octave/rev/6683f0c9d742

I removed the "-1" from dim_vector::dim_max and make check reports no new failures. Maybe it is no longer needed (or maybe it's some untested codepath. Anyone has any insight?

Carnë Draug <carandraug>
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 siko1056 (Posted a comment)
  • -email is unavailable- added by carandraug (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.3