Does any Python library offer a function that implements the "fast inverse square root" algorithm described in following link? http://en.wikipedia.org/wiki/Fast_inverse_square_root Perhaps numpy/SciPy?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can already do the inverse square root just do x**-1/2
so you don't need to make a complicated function to do it and its probably faster to do it this way anyway and its much easier
and like interjay said if you're really worried about the speed of something like that you probably should use a faster more exact language to get a faster way
the only library that maybe has it that i found is mpmath
Good Luck!!
回答2:
You can do this in Python, but not in a very direct way (ie. lots of function calls), so doing x**-.5
will likely be much faster.
So it might be an interesting exercise, but not practical at all.