fixed mat.h
fixing pointer problems and transpose
Running version of the recursive domain transform :P :P