Added NCE gradient test functions that approximates gradients from first principles.
Updated lattice-functions.cc to clean version