Fixes

A few fixes I had to do in order to build it on my system (debian jessie) using atlas.
I moved the template functions in a separate files, because they were called before being defined in gmath.h and the build failed.