This method is for wastes matrices, but can be applied to other matrices.