Example: I have a matrix $R = \left( \begin{array}{cc} A & \mathbf{t} \\ 0 & 1 \end{array} \right) $ where $A$ is 3-by-3 and $\mathbf{t}$ is 3 by 1. Or in Mathematica
A={{1,0,0},{0,0,1},{0,-1,0}};
t={1,1,1}
I would like to be able to use a form of block matrix notation / entry and subsequently find the inverse of R.
Question: Is this possible?
Answer
You're looking for ArrayFlatten
. For your example matrices,
R = ArrayFlatten[ {{A, {t}\[Transpose]},{0, 1}} ]
(*
=> {{1, 0, 0, 1}, {0, 0, 1, 1}, {0, -1, 0, 1}, {0, 0, 0, 1}}
*)
The construct {t}\[Transpose]
is necessary for ArrayFlatten
to treat t
as a column matrix.
Then to find $\boldsymbol{R}^{-1}$, you run
Inverse[R]
(*
=> {{1, 0, 0, -1}, {0, 0, -1, 1}, {0, 1, 0, -1}, {0, 0, 0, 1}}
*)
Comments
Post a Comment