But i can't stop thinking about it...
I don't want to be smart-arse. Just some thoughts out of my head...maybe they are usefull.
>>>> y2Right = ( y2Left + y2Right ) / 2; // meet half way and try again
Is this really the best approximation? (worst-, avg.-, best case senario?)
It seems to be very fixed.
Is it possible to change the direction of the approximation dynamically ?
This may reduce some iteration steps.
----------------------------
>>>> y2Left = F * tanh(F * tanh(X- y2Right) + S1) + S2
I don't know how many iterations (worst,avg, best) it needs to get the result.
But it looks heavy inside a loop (worst case).
Is this the simplest possible formular ? Not possible to transform it mathematically into a formular, which is not so cpu intense?
----------------------------
Atm i don't know if C/C++ is using bit shifting by default (for faster calculating).
----------------------------
I think it's possible to replace/merge a part of the code with assembler.
Assembler should be faster, but also a pain haha.
----------------------------
What about recursion? Would it be slower?
recursion(y2Right) { // y2 = y2Right start with previous sample
y2Left = F * tanh(F * tanh(X- y2Right) + S1) + S2
if( y2Left == y2Right )
return y2Left;
else
recursion( (y2Left + y2Right) / 2); // meet half way and try again
}
//of course F,X,S1,S2 parameters have to be included in the signature
----------------------------
Or maybe the solution is just 43.

