matrix elements correspondence

49 Views Asked by At

I have a $8\times 8$ matrix $A$, I want to break it into $4$ slices each of size $4\times 4$, this way I have a cube of $B$ of size $4\times 4\times 4$. The slices are cut out taking each $4\times 4$ submatrix from $A$ going from left to right. My question is the corresponding location of the value $A(i,j)$ in the cube $B(x',y',z')$. I know that $x'=i\mod 4, y'=i\mod 4$ but how do i get $z'$? Is there something i am missing? If an example helps, If i have $B(1,2,3)$, this means that i am in the third slice (slices start from $0$ upto $3$), so the original $i,j$ would be in $\{4,5,6,7\} $ and since i know $1=i\mod 4$, and $2=j\mod 4$ this $\implies i=5,j=6$. How do i write an explicit formula for this

1

There are 1 best solutions below

5
On BEST ANSWER

Here is the full list of rules for converting from $(i,j)$ to $(x,y,z)$ and back. \begin{array}{l|ll} x=i\mod 4&& i = x+4\cdot \lfloor z/ 2\rfloor \\ y=j\mod 4 && j = y+4\cdot \big(z\mod 2\big) \\ z = 2\lfloor i/4\rfloor +\lfloor j/4\rfloor& \end{array} Here, $n\mod m$ refers to the unique integer $n'$ between $0$ and $m-1$ for which $n-n'$ is a multiple of $m$.