Skip to content

Commit 92664fc

Browse files
committed
Fix python3 error
1 parent e6c8b45 commit 92664fc

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

symengine/lib/symengine_wrapper.pyx

+17-12
Original file line numberDiff line numberDiff line change
@@ -3088,19 +3088,10 @@ cdef class DenseMatrixBase(MatrixBase):
30883088
return NotImplemented
30893089

30903090
def __div__(a, b):
3091-
a = _sympify(a, False)
3092-
b = _sympify(b, False)
3093-
if isinstance(a, MatrixBase):
3094-
if isinstance(b, MatrixBase):
3095-
return a.mul_matrix(b.inv())
3096-
elif isinstance(b, Basic):
3097-
return a.mul_scalar(1/b)
3098-
else:
3099-
return NotImplemented
3100-
else:
3101-
return NotImplemented
3091+
return div_matrices(a, b)
31023092

3103-
__truediv__ = __div__
3093+
def __truediv__(a, b):
3094+
return div_matrices(a, b)
31043095

31053096
def __sub__(a, b):
31063097
a = _sympify(a, False)
@@ -3571,6 +3562,20 @@ cdef class DenseMatrixBase(MatrixBase):
35713562
def expand(self, *args, **kwargs):
35723563
return self.applyfunc(lambda x : x.expand())
35733564

3565+
3566+
def div_matrices(a, b):
3567+
a = _sympify(a, False)
3568+
b = _sympify(b, False)
3569+
if isinstance(a, MatrixBase):
3570+
if isinstance(b, MatrixBase):
3571+
return a.mul_matrix(b.inv())
3572+
elif isinstance(b, Basic):
3573+
return a.mul_scalar(1/b)
3574+
else:
3575+
return NotImplemented
3576+
else:
3577+
return NotImplemented
3578+
35743579
class DenseMatrixBaseIter(object):
35753580

35763581
def __init__(self, d):

0 commit comments

Comments
 (0)