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

 
 

bug #35787: Diagonal matrices don't broadcast

Submitted by:  None
Submitted on:  Sun 11 Mar 2012 06:39:16 AM UTC  
 
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 Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Thu 15 Dec 2016 11:18:05 AM UTC, comment #6:

see also bug #41441 .

Hartmut <hardy>
Sat 19 Nov 2016 08:24:38 PM UTC, comment #5:

These issues are still all present in Octave 4.2.0.

Hartmut <hardy>
Sat 11 Jul 2015 03:50:15 AM UTC, 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 21 Sep 2014 10:32:30 AM UTC, 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 19 Jan 2014 10:35:43 PM UTC, comment #2:

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

Mike Miller <mtmiller>
Project Administrator
Sun 11 Mar 2012 07:25:38 AM UTC, 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 11 Mar 2012 06:39:16 AM UTC, 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 20 Nov 2016 04:39:50 PM UTCrik5Dependencies-=>bugs #37538 is dependent
    Sat 03 Oct 2015 02:15:10 PM UTCmtmillerDependencies-=>bugs #46110 is dependent
    Sun 19 Jan 2014 10:35:43 PM UTCmtmillerCategoryNone=>Libraries
      Release3.6.1=>dev
      Operating SystemBSD=>Any
    Thu 11 Jul 2013 01:02:26 PM UTCjordighDependencies-=>bugs #39462 is dependent
    Thu 11 Jul 2013 01:01:31 PM UTCjordighSummaryBroadcasting inconsistency=>Diagonal matrices don't broadcast
    Sun 11 Mar 2012 07:25:38 AM UTCjordighStatusNone=>Confirmed
      Assigned toNone=>jordigh

    Back to the top


    Powered by Savane 3.1-cleanup1