Added HashFunctions from trove.
Initial conversion of most of Math classes to templates.