creating igain matrix