bugGNU Octave - Bugs: bug #49944, histc is not compatible with...

 
 

bug #49944: histc is not compatible with Matlab when edges set is empty

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Wed 28 Dec 2016 12:33:21 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 08 Feb 2017 05:56:25 AM UTC, comment #6: 

I checked in a fix here (http://hg.savannah.gnu.org/hgweb/octave/rev/af64b6b61db9).  Closing report.

Rik <rik5>
Group administrator
Wed 04 Jan 2017 07:24:59 PM UTC, comment #5: 

Yes, I will try to prepare a changeset.

Avinoam Kalma <avinoam>
Group Member
Wed 04 Jan 2017 06:00:02 PM UTC, comment #4: 

Do you want to prepare a changeset to convert the error to a warning?  It's just an m-file so it should be easy.

Rik <rik5>
Group administrator
Wed 28 Dec 2016 05:33:17 PM UTC, comment #3: 

That's probably a good idea.  The programmer should get some indication that there was something wrong.

Rik <rik5>
Group administrator
Wed 28 Dec 2016 05:24:27 PM UTC, comment #2: 

I have stumbled over this corner case while building and checking
VLFeat library.

One of the tests, vl_test_whistc.m fails (in function test_no_edges()) because 
it expects to get Matlab histc results, and not errors.

Maybe Octave should output Matlab results, but with warning instead of error?

Avinoam Kalma <avinoam>
Group Member
Wed 28 Dec 2016 04:33:03 PM UTC, comment #1: 

What is the use case for this?  When would you want to supply zero edges and get back an empty matrix?  Octave's careful checking of inputs seems better in this case because it will likely catch an error on the part of the programmer.

Rik <rik5>
Group administrator
Wed 28 Dec 2016 12:33:21 PM UTC, original submission:  


In Matlab:


x = rand(10, 20, 30) ;
histc(1, [])
histc(x, [])
histc(x, [], 1)
histc(x, [], 2)
histc(x, [], 3)

ans =
  1×0 empty double row vector
ans =
  0×20×30 empty double array
ans =
  0×20×30 empty double array
ans =
  10×0×30 empty double array
ans =
  10×20×0 empty double array


In Octave I get errors:


>> histc(1, [])

error: histc: EDGES must not be empty
error: called from
    histc at line 57 column 5
>> histc(x, [])

error: histc: EDGES must not be empty
error: called from
    histc at line 57 column 5
>> histc(x, [], 1)

error: histc: EDGES must not be empty
error: called from
    histc at line 57 column 5
>> histc(x, [], 2)

error: histc: EDGES must not be empty
error: called from
    histc at line 57 column 5
>> histc(x, [], 3)

error: histc: EDGES must not be empty
error: called from
    histc at line 57 column 5


Avinoam Kalma <avinoam>
Group 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 avinoam (Submitted the item)
  • -email is unavailable- added by avinoam
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-08 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Release4.2.0 dev
    2017-01-04 rik5 StatusNone Confirmed
    2016-12-28 avinoam Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code