Moved mixture derivatives into their own file and more functions take references rather than pointers

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>