If I type into Mathematica
It gives me a result that has nested matrices. How do I turn that into a normal matrix without any nesting? Thanks
Depends on what dimension your final matrix is supposed to have. When I should make a guess, I would say you want this
TensorProduct[IdentityMatrix, IdentityMatrix] // ArrayFlatten
An alternative approach is to use
KroneckerProduct which does not require flattening.
From the docs on TensorProduct:
KroneckerProductof matrices is equivalent to the flattening of their
TensorProductto another matrix.
That is, for any two matrices
KroneckerProduct[m1, m2] == ArrayFlatten[TensorProduct[m1, m2]] (* True *)
m1 = IdentityMatrix; KroneckerProduct[m1, m1] == ArrayFlatten[TensorProduct[m1, m1]] (* True *)