Skip to content

Commit

Permalink
sympy: proper version check
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Oct 5, 2021
1 parent 2ce93a5 commit e84817a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion devito/finite_differences/elementary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sympy

from distutils import version

from devito.finite_differences.differentiable import DifferentiableFunction, diffify


Expand Down Expand Up @@ -646,7 +648,7 @@ class mathieucprime(DifferentiableFunction, sympy.mathieucprime):


# New elementary functions in sympy 1.8
if float(sympy.__version__) >= 1.8:
if version.LooseVersion(sympy.__version__) >= version.LooseVersion('1.8'):

class motzkin(DifferentiableFunction, sympy.motzkin):
__sympy_class__ = sympy.motzkin
Expand Down
5 changes: 3 additions & 2 deletions examples/seismic/acoustic/wavesolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def adjoint(self, rec, srca=None, v=None, model=None, **kwargs):
dt=kwargs.pop('dt', self.dt), **kwargs)
return srca, v, summary

def jacobian_adjoint(self, rec, u, v=None, grad=None, model=None,
def jacobian_adjoint(self, rec, u, src=None, v=None, grad=None, model=None,
checkpointing=False, **kwargs):
"""
Gradient modelling function for computing the adjoint of the
Expand Down Expand Up @@ -200,7 +200,8 @@ def jacobian_adjoint(self, rec, u, v=None, grad=None, model=None,
time_order=2, space_order=self.space_order)
cp = DevitoCheckpoint([u])
n_checkpoints = None
wrap_fw = CheckpointOperator(self.op_fwd(save=False), src=self.geometry.src,
wrap_fw = CheckpointOperator(self.op_fwd(save=False),
src=src or self.geometry.src,
u=u, dt=dt, **kwargs)
wrap_rev = CheckpointOperator(self.op_grad(save=False), u=u, v=v,
rec=rec, dt=dt, grad=grad, **kwargs)
Expand Down

0 comments on commit e84817a

Please sign in to comment.