Skip to content

Commit af2bf87

Browse files
authored
Merge pull request #282 from isuruf/xreplace
Add xreplace for Matrix
2 parents 7462164 + a6d9db7 commit af2bf87

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

symengine/lib/symengine_wrapper.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,6 +3515,7 @@ cdef class DenseMatrixBase(MatrixBase):
35153515
cdef _DictBasic D = get_dict(*args)
35163516
return self.applyfunc(lambda x: x.subs(D))
35173517

3518+
replace = xreplace = subs
35183519

35193520
@property
35203521
def free_symbols(self):

symengine/tests/test_matrices.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ def test_immutablematrix():
566566
X = ImmutableMatrix([[1, 2], [3, 4]])
567567
Y = ImmutableMatrix([[1, 2], [x, 4]])
568568
assert Y.subs(x, 3) == X
569+
assert Y.xreplace(x, 3) == X
569570

570571
X = ImmutableMatrix([[1, 2], [3, 4]])
571572
Y = ImmutableMatrix([[5], [6]])

0 commit comments

Comments
 (0)