Skip to content

Commit 97e9b60

Browse files
authored
Merge pull request #191 from isuruf/atoms
Fix DenseMatrix.atoms
2 parents b03f044 + 82e2184 commit 97e9b60

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

symengine/lib/symengine_wrapper.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3581,7 +3581,7 @@ cdef class DenseMatrixBase(MatrixBase):
35813581
s = set()
35823582
if (isinstance(self, types)):
35833583
s.add(self)
3584-
for arg in self.tolist():
3584+
for arg in self:
35853585
s.update(arg.atoms(*types))
35863586
return s
35873587
else:

symengine/tests/test_matrices.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,3 +520,9 @@ def test_immutablematrix():
520520
Z = X.col_join(Y)
521521
assert isinstance(Z, ImmutableMatrix)
522522
assert Z == ImmutableMatrix([[1, 2], [3, 4], [5, 6]])
523+
524+
def test_atoms():
525+
a = Symbol("a")
526+
b = Symbol("b")
527+
X = DenseMatrix([[a, 2], [b, 4]])
528+
assert X.atoms(Symbol) == set([a, b])

0 commit comments

Comments
 (0)