Re: Rearranging a tensor
- To: mathgroup at smc.vnet.net
- Subject: [mg22493] Re: [mg22433] Rearranging a tensor
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 5 Mar 2000 00:24:29 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
This is, I hope, the last correction to my messages on this subject. My previous code was quite wasteful, here is the essence: In[1]:= << LinearAlgebra`MatrixManipulation` In[2]:= transform[l_] := Apply[AppendColumns, Map[Apply[AppendRows, #] &, l]] Now with In[3]:= a = {{1, 2}, {3, 4}}; In[4]:= b = Table[1, {3}, {3}]; In[5]:= c = Outer[Times, a, b]; we have: In[6]:= transform[c] // MatrixForm Out[6]//MatrixForm= 1 1 1 2 2 2 1 1 1 2 2 2 1 1 1 2 2 2 3 3 3 4 4 4 3 3 3 4 4 4 3 3 3 4 4 4 At last this seems simple enough.