Minor changes in Custom, Dense and base distances.
Mainly move a few methods from headers to implementation files.
Merge pull request #1178 from iglesias/develop

Minor changes in Custom, Dense and base distances.