Closed gfardell closed 2 years ago
Possibly this should be done at the algorithm level so that the user doesn't even have to bother with it?
Let's add it as a special method of the algorithm class. CGLS
doesn't use it, for instance, but do we mind having it?
I'm not sure we want to add to the memory usage unnecessarily for CGLS.
It would be good for the algorithm to handle it though. We could have an Algorithm member function that allocates 2 copies of the data container (probably as a block) and returns the 2 handles we want them to use (and keeps the 2 real references private). Then the algorithm could handle swapping them every iteration if they exist. We need it to be able to handle more than one variable and variable_prev pair and not assume it's the solution.
Need to check the state of the algorithms
In FISTA and PDHG we copy x to x_old every iteration adding unnecessary overhead.
Instead we should pre-allocate 2 containers, and store a new variable referencing each of them. Each interaction we swap the reference, not the data.
Current:
Proposed: