bugGNU Octave - Bugs: bug #51144, image package: mean2([]) gives...


bug #51144: image package: mean2([]) gives incompatible error

Submitted by:  Hartmut <hardy>
Submitted on:  Tue 30 May 2017 06:05:04 PM UTC  
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  other Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

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


Thu 01 Jun 2017 11:55:26 AM UTC, comment #2: 

I've tested the call to mean2 in Matlab with logicals, 3d arrays, imaginary numbers, sparse matrices. They all give a useful result. So, yes, removing all input checks was the right thing to do here for compatibility concerns.

Hartmut <hardy>
Tue 30 May 2017 10:30:18 PM UTC, comment #1: 

I have pushed http://hg.code.sf.net/p/octave/image/rev/12ef5a4b4fd8 which removes pretty much all input check. I added a bunch more checks for other special cases such as sparse matrices and imaginary numbers.

Carnë Draug <carandraug>
Project Member
Tue 30 May 2017 06:05:04 PM UTC, original submission:  

This happens with Octave 4.2.1 and image-2.6.1:

>> mean2([])
error: mean2: argument must be a 2D image
error: called from
    mean2 at line 31 column 5

>> mean([])
warning: division by zero
warning: called from
    mean at line 116 column 7
ans = NaN

The corresponding output of Matlab (R20124b) is:

>> mean2([])
ans =

>> mean([])
ans =

So the result of mean2 is NOT Matlab compatible for an empty matrix as input. Octave mean2 throws an error, Matlab doesn't.

And this incompatibility of mean2 cannot be blaimed onto te underlying (Octave core function) mean, because its output for an empty matrix as input IS Matlab compatible.

Hartmut <hardy>


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

Attach Files:

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 hardy (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.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-30 carandraug StatusNone => Fixed
        Open/ClosedOpen => Closed
        Release4.2.1 => other

    Back to the top

    Powered by Savane 3.7