There's loads of approximations to tanh which involve just a few multipes, adds and a division. This is usually not as much overhead as the process of solving a Jacobian.urosh wrote:Ok, so single cycle (and even better, simd) mul and div would make greater impact on overall performance? And if I replace tanh with quite close thing with 2 muls and two adds, but get 8th order system of equations, I might get worse performance than with tanh? (I ask this because I'm pondering should I spend time on investigating particular trick).Urs wrote: The non-linear function isn't that big of a deal. The bigger deal is solving the linear system imposed by the Jacobian matrix (green area in the PDF)
Check out Heun's method. One can do either, but this one was particularly well behaved.BTW, for 4, why did you choose average of two "iterations"/estimates, instead of just taking value of second one? (btw, on first glance, this approach looks to me like fixed point iteration, don't know if it actually is equivalent)
As soon as you need more than 2 iterations you'll be slower than Newton's method for 90% of the factory presets... hence I wouldn't even begin to try thisBTW2, have you tried multiple correction steps with 4, for example 4 steps than average? I would be interested in comparison of 32x oversampling vs 4x oversampling + 4 correction steps (should have same processing loads)