bugGNU Octave - Bugs: bug #58869, [octave forge] (symbolic) Failure...


bug #58869: [octave forge] (symbolic) Failure in matrix division

Submitted by:  Rafael Laboissiere <rlaboiss>
Submitted on:  Sun 02 Aug 2020 10:48:55 AM UTC  
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  other Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

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


Sat 31 Oct 2020 10:22:02 AM UTC, comment #1: 

I was trying to look into this issue in order to fix octave-symbolic in Fedora 33 (that has sympy 1.6.2).

One option to solve this problem would be to rework the generated python code so that instead of issuing

eye (2) / Matrix ([[1, 2], [3, 4]])

it would generate the following python code:

eye(2).multiply_elementwise(Matrix ([[1, 2], [3, 4]]).applyfunc(lambda x: 1/x))

This should work, no?

José Matos <jamatos>
Sun 02 Aug 2020 10:48:55 AM UTC, original submission:  

The following is failing with version 2.9.0 of the symbolic package and with SymPy 1.6.1:

octave:1> pkg load symbolic
octave:2> sym (eye (2)) / sym ([1 2; 3 4])
Symbolic pkg v2.9.0: Python communication link active, SymPy v1.6.1.
error: Python exception: TypeError: unsupported operand type(s) for /: 'One' and 'MutableDenseMatrix'
    occurred at line 1 of the Python code block:
    return _ins[0]/_ins[1],
error: called from
    pycall_sympy__ at line 178 column 7
    mrdivide at line 79 column 5

The bug seems to come from SymPy itself:

>>> from sympy import *
>>> eye (2) / Matrix ([[1, 2], [3, 4]])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/sympy/core/decorators.py", line 127, in binary_op_wrapper
    return func(self, other)
  File "/usr/lib/python3/dist-packages/sympy/matrices/common.py", line 2712, in __truediv__
    return self.__div__(other)
  File "/usr/lib/python3/dist-packages/sympy/core/decorators.py", line 127, in binary_op_wrapper
    return func(self, other)
  File "/usr/lib/python3/dist-packages/sympy/matrices/common.py", line 2452, in __div__
    return self * (self.one / other)
TypeError: unsupported operand type(s) for /: 'One' and 'MutableDenseMatrix'

BTW, this problem cause the failure of many unit tests in inst/@sym/mrdivide.m.

Rafael Laboissiere <rlaboiss>


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jamatos (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)

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

    Only project members can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5