inverse diagonal matrix python