18 ms·
I don't have advice on the specific `sin(x) / x`/`cos(x) / x^2`, but the Sleef vectorization library [0,1] supports operations with varying precision. (0.506, 1
by stochastic_monk 9y ago
I don't have advice on the specific `sin(x) / x`/`cos(x) / x^2`, but the Sleef vectorization library [0,1] supports operations with varying precision. (0.506, 1.0, and 3.5 ULP)
If you're working in a case where you can afford slightly lower accuracy, the 3.5ULP method can be a very significant speedup, especially since you're vectorizing at the same time. I got dozens of times in speedup when testing just the 1.0 ULP bound when performing sin/cos on a large vector. (I don't remember the precise number and should just re-run the tests.)
To generically dispatch this library, in case there's any interest, I wrapped it in some template metaprogramming in [2], so that the widest vectorization available is selected at compile-time when selecting a given operation.
[0]: http://sleef.org/ http://sleef.org/
[1]: https://github.com/shibatch/sleef https://github.com/shibatch/sleef
[2]: https://github.com/dnbaker/vec https://github.com/dnbaker/vec
- vanderZwan 9y agoThanks, forwarded your comment to a few colleagues who might have a use for it!