Initial Commit: mex file for energy Minimization.