wheigthed diagonal matrix correctly