Re: Dealing with submatrices
- To: mathgroup at smc.vnet.net
- Subject: [mg18174] Re: [mg18099] Dealing with submatrices
- From: "Tomas Garza" <tgarza at mail.internet.com.mx>
- Date: Sat, 19 Jun 1999 23:54:32 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Chris Hall [chall at aoe.vt.edu] wrote:
> I want to construct a 9x9 matrix using 9 existing 3x3 matrices:
> M = { {m11, m12, m13}, {m21, m22, m23}, {m31, m32, m33}}
>
> The problem is that this creates a too-deep nested list and I can't
> figure out how
> to make it a 9x9. Flatten doesn't appear to be the right tool.
Hello Chris,
First, rearrange m (in Mathematica it is good form to use lower-case for
symbols defined by the user) by transposing the indices, so that p, say, is
p= {{m11, m21, m31},{m12, m22, m32},{m13, m23, m33}}
Then
In[1]:=
Partition[Flatten[MapThread[List, Partition[Join @@ p, 9]]], 9]
will do the trick.
Hope this helps,
Tomas Garza
Mexico City