Simple matrix functionality.