Description
Before we release version 3.0, I would like to perform some changes to the general framework for linear iterative solvers.
- Remove interface InvertibleRealLinearOperator: this was only proposed for handling preconditioners. Let M be this preconditioner. In the course of the iterations, only matrix-vector products of the form M^(-1) . y are needed, never direct products M . x. So it's just as simple to provide M^(-1) as a standard RealLinearOperator, rather than M as an InvertibleRealLinearOperator. This removes a little bit of clutter in the class hierarchy.
- o.a.c.m.util.IterationEvent should at the very least have a method to get the current iteration number. Overwise, I find myself keeping track of the number of times o.a.c.m.util.IterationManager.fireIterationPerformedEvent(IterationEvent) is called, which is both ugly and painfull.
- o.a.c.m.util.linear.IterativeLinearSolverEvent should have a method to access the norm of the residual. I was reluctant to specify such a method in the interface at the start, because I was not sure any iterative solver provides an updated estimate of this quantity at each iteration. In fact, I've realized that most (if not all) solvers do, and it's quite nice to be able to access this value while monitoring the progress of the inversion (through o.a.c.m.utils.IterationListener). Otherwise, one has to compute b - A . x inside the listener, which doubles the cost of each iteration!
- o.a.c.m.util.linear.IterativeLinearSolverEvent should have a method to access the residual (the vector itself, not only its norm). I'm not sure all solvers can do that, so this should be an optional feature, which might be useful. I see two different possible implementations
- specify RealVector o.a.c.m.util.linear.IterativeLinearSolverEvent.getResidual() as an optional feature (potentially throwing UnsupportedOperationException), together with a method boolean o.a.c.m.util.linear.IterativeLinearSolverEvent.providesResidual(). I think some of us do not like UnsupportedOperationException, but this would be similar to what was done in RealLinearOperator.operateTranspose(RealVector).
- create a new interface RealVector o.a.c.m.util.linear.IterativeLinearSolverWithResidualEvent. This is similar to what is done currently, see o.a.c.m.linear.ProvidesResidual.
I would love to have some feedback on the last point.