Added messages to asserts in matrix functions