bugGNU Octave - Bugs: bug #52489, Incorrect Result when adding 2...

 
 

bug #52489: Incorrect Result when adding 2 matrices with different dimensions

Submitted by:  None
Submitted on:  Thu 23 Nov 2017 05:45:09 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: THHOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.2.1
Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 23 Nov 2017 06:25:24 PM UTC, comment #2:

This is correct behavior. See the documentation on Broadcasting (https://www.gnu.org/software/octave/doc/interpreter/Broadcasting.html). Both Python and Octave do broadcasting, and recent versions of Matlab have followed this behavior and do it as well.

Rik <rik5>
Project Administrator
Thu 23 Nov 2017 06:05:02 PM UTC, comment #1:

No, this is valid.

https://www.gnu.org/software/octave/doc/interpreter/Broadcasting.html

In Matlab, this is now allowed too:

https://www.mathworks.com/help/matlab/matlab_prog/compatible-array-sizes-for-basic-operations.html

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Thu 23 Nov 2017 05:45:09 PM UTC, original submission:

>> a = [1;2;3;4]

a =

1
2
3
4

>> b = [1,2,3,4]

b =

1 2 3 4

>> c = a + b

c =

2 3 4 5
3 4 5 6
4 5 6 7
5 6 7 8

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 23 Nov 2017 06:05:19 PM UTCjordighStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1