Newton Raphson with SSE2 - can someone explain me these 3 lines

前端 未结 2 1676
谎友^
谎友^ 2020-12-05 13:36

I\'m reading this document: http://software.intel.com/en-us/articles/interactive-ray-tracing

and I stumbled upon these three lines of code:

Th

2条回答
  •  余生分开走
    2020-12-05 14:05

    To compute the inverse square root of a, Newton's method is applied to the equation 0=f(x)=a-x^(-2) with derivative f'(x)=2*x^(-3) and thus the iteration step

    N(x) = x - f(x)/f'(x) = x - (a*x^3-x)/2 
         = x/2 * (3 - a*x^2)
    

    This division-free method has -- in contrast to the globally converging Heron's method -- a limited region of convergence, so you need an already good approximation of the inverse square root to get a better approximation.

提交回复
热议问题