Skip to content

Commit

Permalink
bug: fix ista/fista for cupy arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mrava87 committed Jul 19, 2022
1 parent 7de94c6 commit 1f35d9d
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 1f35d9d

Please sign in to comment.