bugGNU Octave - Bugs: bug #35787, Diagonal matrices don't broadcast

 
 

bug #35787: Diagonal matrices don't broadcast

Submitted by:  None
Submitted on:  Sun Mar 11 06:39:16 2012  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: Jordi GutiĆ©rrez Hermoso <jordigh>
Originator Name: forkandwaitOriginator Email: -unavailable-
Open/Closed: OpenRelease: dev
Operating System: Any

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sat Nov 19 20:24:38 2016, comment #5:

These issues are still all present in Octave 4.2.0.

Hartmut <hardy>
Sat Jul 11 03:50:15 2015, comment #4:

This is still an issue in version 4.0.0.

It is easy to work around by placing the diagonal matrix in [...]:

> [eye(2)] + [1 0]

ans =

2 0
1 1

However, that is not done in some library routines (I was bitten by mvnrnd.m) and so Matlab-compliant user code that does not rely on automatic broadcasting can be affected. The bug has been open for three years; is it time to rewrite all library routines to work around it?

Another surprising twist is that a slice of a diagonal matrix is still considered "diagonal".

> a = eye(2);
> b = a(1,:)

b =

Diagonal Matrix

1 0

> b + [1; 0]

error: operator +: nonconformant arguments (op1 is 1x2, op2 is 2x1)

Lachlan Andrew <lachlan>
Project Member
Sun Sep 21 10:32:30 2014, comment #3:

I encountered something similar with automatic broadcasting and sparse vectors:

ones(3,10).*[0;2;0] # works as expected

ones(3,10).*sparse(2,1,2,3,1) # does not work

and yields the following error message:
error: product: nonconformant arguments (op1 is 3x10, op2 is 3x1)

I am on version 3.8.1

CH <atcl>
Sun Jan 19 22:35:43 2014, comment #2:

Still present on the current development version of Octave (hg rev c1baf94184af):

Mike Miller <mtmiller>
Project Administrator
Sun Mar 11 07:25:38 2012, comment #1:

Hm, I guess I missed a few cases with the diagonal matrices. I'll look into it.

Jordi GutiƩrrez Hermoso <jordigh>
Project AdministratorIn charge of this item.
Sun Mar 11 06:39:16 2012, original submission:

I think broadcasting should work like #12, but #10 gives error.

10> eye(4) .- (1:4)'
error: operator -: nonconformant arguments (op1 is 4x4, op2 is 4x1)
11> eye(4) .* (1:4)'
warning: product: automatic broadcasting operation applied
ans =

1 0 0 0
0 2 0 0
0 0 3 0
0 0 0 4

12> eye(4) .- repmat((1:4)',1,4)
ans =

0 -1 -1 -1
-2 -1 -2 -2
-3 -3 -2 -3
-4 -4 -4 -3

13> version
ans = 3.6.1-rc0

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

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by lachlan (Posted a comment)
  • -unavailable- added by atcl (Posted a comment)
  • -unavailable- added by mtmiller (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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Nov 20 16:39:50 2016rik5Dependencies-=>bugs #37538 is dependent
    Sat Oct 3 14:15:10 2015mtmillerDependencies-=>bugs #46110 is dependent
    Sun Jan 19 22:35:43 2014mtmillerCategoryNone=>Libraries
      Release3.6.1=>dev
      Operating System*BSD=>Any
    Thu Jul 11 13:02:26 2013jordighDependencies-=>bugs #39462 is dependent
    Thu Jul 11 13:01:31 2013jordighSummaryBroadcasting inconsistency=>Diagonal matrices don't broadcast
    Sun Mar 11 07:25:38 2012jordighStatusNone=>Confirmed
      Assigned toNone=>jordigh

    Back to the top


    Powered by Savane 3.1-cleanup