n-dimensional thin plate splines in c and matlab