Finite difference method in DARTS code

For my DARTS coding , how to do the coding for Ltrain(w+) and Ltrain(w-) inside equation (8) of DARTS paper ?

Note: Upon checking the definition of finite difference method at MATH behind DARTS , it seems that the above 2 lines of code are wrong.

but the question is how to modify these 2 lines of code ?