Skip to content

Commit

Permalink
Set initial guess x0 to zeroes
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanbabbar04 committed Apr 2, 2024
1 parent 6c0fd3c commit 3ffdf8e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/plot_cgls.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
# are then obtained in a :py:class:`pylops_mpi.DistributedArray`. To obtain the
# overall inversion of the entire MPIBlockDiag, you can utilize the ``asarray()``
# function of the DistributedArray as shown below.
xinv, istop, niter, r1norm, r2norm, cost = pylops_mpi.cgls(BDiag, y, niter=15, tol=1e-10, show=True)

# Set initial guess `x0` to zeroes
x0 = pylops_mpi.DistributedArray(BDiag.shape[1], dtype=np.float128)
x0[:] = 0
xinv, istop, niter, r1norm, r2norm, cost = pylops_mpi.cgls(BDiag, y, x0=x0, niter=15, tol=1e-10, show=True)
xinv_array = xinv.asarray()

if rank == 0:
Expand Down

0 comments on commit 3ffdf8e

Please sign in to comment.