bugGNU Octave - Bugs: bug #51249, center() relies on broadcasting


bug #51249: center() relies on broadcasting

Submitter:  Guillaume <gyom>
Submitted:  Fri 16 Jun 2017 02:10:26 PM UTC
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Tue 08 Aug 2017 03:54:40 PM UTC, comment #4: 
Rik <rik5>
Group administrator
Tue 08 Aug 2017 09:52:15 AM UTC, comment #3: 

Thanks Rik and sorry for having forgotten about this. You cset fixes the problem. I haven't come across other places in the code where broadcasting was an issue.

Guillaume <gyom>
Mon 07 Aug 2017 04:07:57 PM UTC, comment #2: 

Try the attached cset center.cset.  If there are other common uses of broadcasting it would be best to find them now and temporarily replace them.

(file #41448)

Rik <rik5>
Group administrator
Fri 16 Jun 2017 03:43:21 PM UTC, comment #1: 

It would be okay to modify center until this is fixed.  If you can submit a proposed patch that would help.  In the code, before the modification, add a note about why this is being done and when it can be reverted.  Something like

## FIXME: Use bsxfun, rather than broadcasting, until broadcasting
##        supports diagonal and sparse matrices (Bugs #41441, #35787).

Rik <rik5>
Group administrator
Fri 16 Jun 2017 02:10:26 PM UTC, original submission:  

The fact that center() relies on broadcasting makes it crash when the input is a sparse or diagonal matrix:

>> center (eye (3))
error: center: operator -: nonconformant arguments (op1 is 3x3, op2 is 1x3)
error: called from
    center at line 72 column 12
>> center (sparse (rand (3)))
error: center: operator -: nonconformant arguments (op1 is 3x3, op2 is 1x3)
error: called from
    center at line 72 column 12

These limitations of broadcasting are known (see bug #41441 and bug #35787) but are quite annoying when core functions rely on it - I came across this while calling var() on a sparse matrix.

If fixing the mentioned bugs are long term projects, would it be ok to modify center() not to rely on broadcasting and use bsxfun() instead?

Guillaume <gyom>


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

Attach Files:

Attached Files
file #41448:  center.cset added by rik5 (1KiB - application/octet-stream)


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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-08 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-08-07 rik5 Attached File- Added center.cset, #41448
        StatusConfirmed Patch Submitted
    2017-06-16 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code