Adding matrix functions and types