bugGNU Octave - Bugs: bug #60968, broadcasting not implemented for...

 
 

bug #60968: broadcasting not implemented for "special" matrix types

Submitter:  None
Submitted:  Mon 26 Jul 2021 08:06:05 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Marc Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 26 Jul 2021 03:28:36 PM UTC, comment #5: 

No need to open new reports.
We already have open reports for some of those types and we can rename this report for the remainder.

Broadcasting with
- diagonal matrices: bug #35787
- sparse matrices: bug #41411 and bug #59718

I couldn't find reports for permutation matrices and ranges.

Markus Mützel <mmuetzel>
Group administrator
Mon 26 Jul 2021 02:55:30 PM UTC, comment #4: 

Broadcasting is currently only implemented for full matrices.

In addition to sparse matrices, Octave also uses special representation for diagonal (the value returned by eye is stored this way) and permutation matrices (like the permutation matrix returned by the lu function) and ranges.  Broadcasting is also not fully implemented for those types.

You can disable these special types by using the functions disable_diagonal_matrix, disable_permutation_matrix, and disable_range or by starting Octave with the --traditional option.

The reason (a+0) + b works in your example is that adding zero to the diagonal matrix forces it to be full.  Even though the conversion is not necessary when adding zero, it happens because there is no special case for adding zero.

For the permutation matrix, diagonal matrix, and range types, we should probably just convert to full for any of these operations so that broadcasting will work and then add special cases to perserve the memory savings of the special types where possible and as developer time and interest permits.

I don't think it is reasonable to do the same thing for sparse matrices because Matlab compatibility requires that the results be sparse in most (all?) cases.

John W. Eaton <jwe>
Group administrator
Mon 26 Jul 2021 02:15:04 PM UTC, comment #3: 

Okay, should I file a new report with a correct title for the non-sparse part?

Anonymous
Mon 26 Jul 2021 08:48:44 AM UTC, comment #2: 

with regard to the sparse part see bug #59718

A.R. Burgers <arb>
Mon 26 Jul 2021 08:21:11 AM UTC, comment #1: 

Sorry, the problem is not specific to sparse matices very puzzled

The following code produced the same error, which, I really think, it should not.

a = eye(10);
b = zeros(10,1);
b(1) = 1;
a + b


Then again... the following works:

a = eye(10);
b = zeros(10,1);
b(1) = 1;
(a + 0) + b



Anonymous
Mon 26 Jul 2021 08:06:05 AM UTC, original submission:  

The following code produces the error:
error: operator +: nonconformant arguments (op1 is 10x10, op2 is 10x1)


a = speye(10);
b = sparse(10,1);
b(1) = 1;
a + b
plus(a,b)


Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by arb (Posted a comment)
  • -email is unavailable- added by None (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-07-26 mmuetzel Dependencies- Depends on bugs #41441
    2021-07-26 mmuetzel CategoryOctave Function Interpreter
        Item GroupUnexpected Error or Warning Feature Request
        Release6.1.0 dev
        Operating SystemGNU/Linux Any
        Summary&quot;plus&quot; does not expand sparse matrices broadcasting not implemented for "special" matrix types
        Dependencies- Depends on bugs #35787

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code