Skip to content

Commit

Permalink
Merge pull request #409 from mrava87/v1.18.x
Browse files Browse the repository at this point in the history
bug: fix ista/fista for cupy arrays
  • Loading branch information
mrava87 authored Jul 19, 2022
2 parents 1cf20d0 + 1f35d9d commit 17d77bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pylops/optimization/sparsity.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def ISTA(
Op1, niter=eigsiter, tol=eigstol, dtype=Op1.dtype, backend="cupy"
)[0]
)
alpha = 1.0 / maxeig
alpha = 1.0 / float(maxeig)

# define threshold
thresh = eps * alpha * 0.5
Expand Down Expand Up @@ -959,8 +959,8 @@ def ISTA(
normresold = normres

# compute gradient
grad = alpha * Op.H @ res

grad = alpha * (Op.H @ res)
# update inverted model
xinv_unthesh = xinv + grad
if SOp is not None:
Expand Down Expand Up @@ -1211,7 +1211,7 @@ def FISTA(
Op1, niter=eigsiter, tol=eigstol, dtype=Op1.dtype, backend="cupy"
)[0]
)
alpha = 1.0 / maxeig
alpha = 1.0 / float(maxeig)

# define threshold
thresh = eps * alpha * 0.5
Expand Down Expand Up @@ -1254,7 +1254,7 @@ def FISTA(
resz = data - Op @ zinv

# compute gradient
grad = alpha * Op.H @ resz
grad = alpha * (Op.H @ resz)

# update inverted model
xinv_unthesh = zinv + grad
Expand Down

0 comments on commit 17d77bf

Please sign in to comment.