I have a $2\times2$ or $3\times3$ transformation matrix $T$, which is the product of two transformations $T=AB$. (e.g. affine transformations). The elements of $A$ can be implemented as floating point numbers, where the elements of $B$ are fixed point with a given finite range (say $-10, \dots, +10$) and the elements of $B$ shall utilize that range as much as possible.
My idea was to introduce a control variable $\gamma$, which I can optimize to get the best balance between the fixed- and the floating point part: \begin{align} A' &= f(\gamma, A, B) \\ B' &= g(\gamma, A, B) \end{align} with \begin{align} f(0, A, B) &= AB \\ f(1, A, B) &= 1 \\ g(0, A, B) &= 1 \\ g(1, A, B) &= AB \end{align} and $$ T = f(\gamma, A, B) \cdot g(\gamma, A, B) = AB\ \forall\ \gamma \in [0,1] $$
But how can I find the functions $f$ and $g$ which fulfill the above boundary conditions?
Assuming that we can interpret $1$ as the identity matrix $I$ of appropriate size, linear interpolation should work: $$ f(\gamma, A, B) = (1 - \gamma) AB + \gamma I. $$ This has the property that $f(0, A, B) = AB$ and $f(1, A, B) = I$.
In fact, any parametrized path from $(x, y) = (1, 0)$ to $(x, y) = (0, 1)$ will do. This is the linear path $$ (x, y) = (1 - \gamma, \gamma), \quad 0 \leq \gamma \leq 1. $$
Can you write down the linear interpolation for $g$?