PyLops / pylops

PyLops – A Linear-Operator Library for Python
https://pylops.readthedocs.io
GNU Lesser General Public License v3.0
429 stars 102 forks source link

bug: ensure array shape consistency in leastsquares solvers #624

Closed mrava87 closed 1 day ago

mrava87 commented 1 day ago

PyLops solvers output the solution as a nd-shaped array if the initial model is fed as nd-arrays or if the initial model is not fed (x0=0) and the operator has forceflat=False. As a side effect, if x0 is NOT passed as a kwarg (but just as the third arg of the solver) and the operator forceflat=False, the output is reshaped even if x0 is a flattened array. I fix this inconsistency making x0 a kwarg when basic solvers are called within a leastsquares solver.