Skip to content

Commit 17202b7

Browse files
committed
api: prevent sympy warnings with diag
1 parent 20c50cc commit 17202b7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

devito/finite_differences/operators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from sympy import S
2+
3+
14
def div(func, shift=None, order=None, method='FD', side=None, **kwargs):
25
"""
36
Divergence of the input Function.
@@ -194,6 +197,6 @@ def diag(func, size=None):
194197
to = getattr(func, 'time_order', 0)
195198

196199
tens_func = TensorTimeFunction if func.is_TimeDependent else TensorFunction
197-
comps = [[func if i == j else 0 for i in range(dim)] for j in range(dim)]
200+
comps = [[func if i == j else S.Zero for i in range(dim)] for j in range(dim)]
198201
return tens_func(name='diag', grid=func.grid, space_order=func.space_order,
199202
components=comps, time_order=to, diagonal=True)

0 commit comments

Comments
 (0)