Skip to content

Commit

Permalink
Fixing bug in TraceDiffusionOp with isotropic diffusion coefficient
Browse files Browse the repository at this point in the history
  • Loading branch information
dhamm97 committed Apr 27, 2023
1 parent 00843e1 commit b872549
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/pycsou/operator/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,10 +1592,13 @@ def _sanitize_init_args(
if trace_diffusion_coefficient:
if trace_diffusion_coefficient.isotropic:
ops = []
for dim in np.range(self.ndims):
idx = 0
for dim in range(self.ndims):
# select second order derivative operators
ops.append(hessian._block[(dim, dim)])
hessian = pyblock.hstack(ops)
ops.append(hessian._block[(idx, 0)])
idx += self.ndims - dim
hessian = pyblock.vstack(ops)
hessian = pydiff._make_unravelable(hessian, arg_shape=arg_shape)

# returning only objects that might have been modified.
return (
Expand Down Expand Up @@ -1991,7 +1994,7 @@ def __init__(
if outer_trace_diffusivity:
_known_diff_lipschitz = _known_diff_lipschitz and outer_trace_diffusivity.bounded
if _known_diff_lipschitz:
self._diff_lipschitz = hessian.lipschitz()
self._diff_lipschitz = 8 / (hessian.sampling[0] ** 2) # hessian.lipschitz()

@pycrt.enforce_precision(i="arr")
@pycu.vectorize("arr")
Expand Down

0 comments on commit b872549

Please sign in to comment.