I need to convert n-dimensional vectors into hyperspherical coordinates, which involves doing calculating an arctan with an argument which is the square root of a sum of squares (i.e., the radius of a truncated vector) once for every non-radial dimension. The squares can all be precomputed and re-used, but the sum to be rooted is different every time.
Is there a faster way to compute the angles than just calculating a new square root followed by an arctan every time? Either a way to incrementally update the square root, or directly compute an arctan of squared inputs?
atan()
oratan2()
? I suspect it is the latter, but it would be beneficial to clarify this in the question. $\endgroup$atan2()
implementation, you could try the fast, low-precision, algorithm from a previous answer of mine. $\endgroup$