Iterative proportional fitting
The iterative proportional fitting procedure (IPF or IPFP, also known as biproportional fitting or biproportion in statistics or economics (input-output analysis, etc.), RAS algorithm in economics, raking in survey statistics, and matrix scaling in computer science) is the operation of finding the fitted matrix X {\displaystyle X} which is the closest to an initial matrix Z {\displaystyle Z} but with the row and column totals of a target matrix Y {\displaystyle Y} (which provides the constraints of the problem; the interior of Y {\displaystyle Y} is unknown). The fitted matrix being of the form X = P Z Q {\displaystyle X=PZQ} , where P {\displaystyle P} and Q {\displaystyle Q} are diagonal matrices such that X {\displaystyle X} has the margins (row and column sums) of Y {\displaystyle Y} .
Source: Wikipedia — Iterative proportional fitting (CC BY-SA 4.0)