Split matrix header to prototypes and implementation