TomographicImaging / CIL

A versatile python framework for tomographic imaging
https://tomographicimaging.github.io/CIL/
Apache License 2.0
97 stars 44 forks source link

CGLS overwrites the initial #1222

Closed zeljkozeljko closed 2 years ago

zeljkozeljko commented 2 years ago

The initial is passed into the set_up method, but it is only used in this line where it is overwritten with zeros. Is that correct? On the other hand, in their set_up method GD, ADMM, SIRT, SPDHG do self.x = initial.copy(), FISTA does both self.x_old = initial.copy() and self.x = initial.copy(), and PDHG does self.x_old = initial.copy() and self.x = self.x_old.copy()

https://github.com/TomographicImaging/CIL/blob/801a24d81092202be48dc122a203abbf4ff04d3e/Wrappers/Python/cil/optimisation/algorithms/CGLS.py#L76

paskino commented 2 years ago

Thanks for finding the bug.

Probably all algorithms need a bit of care.

In particular with initial I believe that we might just use it and not create another copy, i.e. if an user passes us an initial we'll use the memory to store the solution.