buildlookup function

Build Lookup Tables for Fast Distance Computation