A Nonlinear Acceleration Method for Iterative Algorithms