Domanda

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?

È stato utile?

Soluzione 2

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!!

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top