Skip to content

Commit

Permalink
Merge pull request #416 from tlm-adjoint/jrmaddison/functional_fix
Browse files Browse the repository at this point in the history
Functional annotation bugfix
  • Loading branch information
jrmaddison authored Oct 23, 2023
2 parents 41240b9 + 6d69053 commit 4657d5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tlm_adjoint/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ def addto(self, y, *, annotate=None, tlm=None):
"""

if is_var(y) and var_is_scalar(y):
J_old = self.new().assign(self)
J_old = self.new(self, annotate=annotate, tlm=tlm)
Axpy(self, J_old, 1.0, y).solve(annotate=annotate, tlm=tlm)
elif isinstance(y, (int, np.integer, sp.Integer,
float, np.floating, sp.Float,
complex, np.complexfloating,
sp.Expr)):
super().addto(y, annotate=annotate, tlm=tlm)
else:
J_old = self.new().assign(self)
J_old = self.new(self, annotate=annotate, tlm=tlm)
b = self.new()
functional_term_eq(b, y).solve(annotate=annotate, tlm=tlm)
Axpy(self, J_old, 1.0, b).solve(annotate=annotate, tlm=tlm)
Expand Down

0 comments on commit 4657d5f

Please sign in to comment.