Re: *Matrix witihn matrix*

• To: mathgroup at yoda.physics.unc.edu
• Subject: Re: *Matrix witihn matrix*
• From: olness at phyvms.physics.smu.edu (Fredrick Olness (214) 768-2500 or -2495, Fax -4095)
• Date: Tue, 28 Jun 1994 11:11:32 -0500

```Roger,

I have attached a simple sequence to generate the same output as:

CatMatrix[a_,b_,c_,d_]:=Block[{t1},
t1=Length[a];Join[Table[Flatten[{a[[i]],b[[i]]}],
{i,1,t1}],Table[Flatten[{c[[i]],d[[i]]}],
{i,1,t1}]]].

I do not know what you want to do with this object, but
for many purposes, you may find it easier to simply use
mat={{a,b},{c,d}} and work with this object since it contains
the information to later decompse mat back into {a,b,c,d} after
you have performed any operations.

Fred Olness
olness at phyvms.physics.smu.edu

===============================================================
In[65]:=
CatMatrix[a_,b_,c_,d_]:=Block[{t1},
t1=Length[a];Join[Table[Flatten[{a[[i]],b[[i]]}],
{i,1,t1}],Table[Flatten[{c[[i]],d[[i]]}],
{i,1,t1}]]]

In[66]:=
a={{a11,a12,a13},{a21,a22,a23},{a31,a32,a33}};
b={{b11,b12,b13},{b21,b22,b23},{b31,b32,b33}};
c={{c11,c12,c13},{c21,c22,c23},{c31,c32,c33}};
d={{d11,d12,d13},{d21,d22,d23},{d31,d32,d33}};

In[70]:=
test1=
( List[{a,b},{c,d}] //Transpose[#,{1,3,2}]&
//Flatten
//Partition[#,6]&
)

Out[70]=
{{a11, a12, a13, b11, b12, b13},
{a21, a22, a23, b21, b22, b23},
{a31, a32, a33, b31, b32, b33},
{c11, c12, c13, d11, d12, d13},
{c21, c22, c23, d21, d22, d23},
{c31, c32, c33, d31, d32, d33}}

In[71]:=
test2=CatMatrix[a,b,c,d];
test1==test2

Out[72]=
True

```

• Prev by Date: Transformation of Expressions
• Next by Date: Re: *Matrix witihn matrix*
• Previous by thread: *Matrix witihn matrix*
• Next by thread: Re: *Matrix witihn matrix*