deleted memory allocated for matrix