Consider a matrix $A$ whose size is $n\times n$, and the following Baker's map, that maps $A$ to $B$, whose size is $\frac{n}{2}\times2n$:
$$ B(i,j) = \begin{cases} \frac{1}{2}\left(A(2i,\lceil\frac{j}{2}\rceil) + A(2i-1,\lceil\frac{j}{2}\rceil) \right) & j\text{ is odd}\\ p\cdot A(2i,\lceil\frac{j}{2}\rceil)+(1-p) A(2i+1,\lceil\frac{j}{2}\rceil) & j\text{ is even} \\\end{cases}$$ where $\lceil i\rceil$ is a ceiling function acting on $i$ (smallest integer larger or equal to $i$),
$0<p<1$, and the indices are periodic in $n$, i.e, $A(n+1,j)=A(1,j)$.
this is an example of the mapping for an image of $100\times100$ pixels, where $p=0.55$
How would the inverse mapping from $B_{\frac{n}{2}\times 2n}$ back to $A_{n\times n}$ be written?
