In paper Efficient and Reliable Schemes for Nonlinear Diffusion Filtering i have difficulty to understand the following step.
We have equation and its discretization in 1D case:
$$\partial_tu = \partial_x[g\times\partial_xu]$$
$$\frac{u_i^{k+1}-u_i^k}{\tau} = \sum_{j\in \mathcal N(i)}\frac{g_j^k+g_i^k}{2h^2}(u_j^k-u_i^k), $$
where $\mathcal N(i)$ is the set of the two neighbors of pixel $i$.
I don't get how did the authors get this discretization.
It looks like a second-order discretization using a centered finite difference approximation of $u_x$. \begin{align} \partial_x[g\times\partial_x u] &\approx \dfrac{g_{i+1/2} (u_x)_{i+1/2} - g_{i-1/2} (u_x)_{i-1/2}}{2(h/2)} \tag{1} \\ &\approx \dfrac{g_{i+1/2} \dfrac{u_{i+1}-u_i}{2(h/2)} - g_{i-1/2} \dfrac{u_i-u_{i-1}}{2(h/2)}}{2(h/2)} \tag{2} \\ &= \dfrac{g_{i+1/2} (u_{i+1}-u_i)}{h^2} + \dfrac{g_{i-1/2}(u_{i-1} - u_i)}{h^2} \tag{3} \\ &\approx \dfrac{\dfrac{g_{i+1}+g_i}{2} (u_{i+1}-u_i)}{h^2} + \dfrac{\dfrac{g_i+g_{i-1}}{2}(u_{i-1} - u_i)}{h^2} \tag{4} \\ &= \dfrac{g_{i+1}+g_i}{2h^2}(u_{i+1}-u_i) + \dfrac{g_{i-1}+g_i}{2h^2}(u_{i-1} - u_i) \tag{5} \end{align}