Skip to content

Commit 49b9b7c

Browse files
committed
Add freeze_thaw in build_jacobian
1 parent ff167b3 commit 49b9b7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

grudge/tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def build_jacobian(
7676
supported by *actx*.
7777
:returns: a two-dimensional :class:`numpy.ndarray`.
7878
"""
79+
base_state = actx.freeze_thaw(base_state)
7980
from arraycontext import flatten, unflatten
8081
flat_base_state = flatten(base_state, actx)
8182

@@ -89,8 +90,8 @@ def build_jacobian(
8990
unit_i_flat = np.zeros(n, dtype=mat.dtype)
9091
unit_i_flat[i] = stepsize
9192

92-
f_unit_i = f(base_state + unflatten(
93-
base_state, actx.from_numpy(unit_i_flat), actx))
93+
f_unit_i = f(actx.freeze_thaw(base_state + unflatten(
94+
base_state, actx.from_numpy(unit_i_flat), actx)))
9495

9596
mat[:, i] = actx.to_numpy(flatten((
9697
f_unit_i - f_base

0 commit comments

Comments
 (0)