Re: Condensing a 4-Tensor into a 2-Tensor
- To: mathgroup at smc.vnet.net
- Subject: [mg45139] Re: Condensing a 4-Tensor into a 2-Tensor
- From: poujadej at yahoo.fr (Jean-Claude Poujade)
- Date: Thu, 18 Dec 2003 06:55:14 -0500 (EST)
- References: <brpl2b$7pg$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Ashok. R" <ashokr at alum.dartmouth.org> wrote in message news:<brpl2b$7pg$1 at smc.vnet.net>... > Greetings. > > I have a 4-Tensor H, whose components are given by H[i,j,k,l]. The tensor > has minor symmetries so that H[i,j,k,l] = H[j,i,k,l] = H[i,j,l,k]. So there > are only 36 distinct components in this tensor. I want to condense these > into a 6x6 2-tensor (Matrix), D, with the following rules: > > D(1,1) should map to H[1,1,1,1] > D(1,2) should map to H[1,1,2,2] > D(1,3) should map to H[1,1,3,3] > D(1,4) should map to H[1,1,1,2] > D(1,5) should map to H[1,1,1,3] > D(1,6) should map to H[1,1,2,3] and so on. > > Basically for D(i,j) : > If i<=3, replace i with i,i in H > If i = 4, replace i with 1,2 in H > If i = 5, replace i with 1,3 in H > if i = 6, replace i with 2,3 in H > > The rules are the same for j: > If j<=3, replace j with j,j H > If j = 4, replace j with 1,2 in H > If j = 5, replace j with 1,3 in H > if j = 6, replace j with 2,3 in H > > The only way I can think of is the tedious way of assigning all 3,6 entries > individually. Is there a shorter, more elegant way to do this ? > > Thanks, > > Ashok d[i_ /; i <= 3,j_]:=temp[i,i,j]; d[4,j_]:=temp[1,2,j]; d[5,j_]:=temp[1,3,j]; d[6,j_]:=temp[2,3,j]; temp[i_,j_,k_ /; k <= 3]:=h[i,j,k,k]; temp[i_,j_,4]:=h[i,j,1,2]; temp[i_,j_,5]:=h[i,j,1,3]; temp[i_,j_,6]:=h[i,j,2,3]; Array[d,{6,6}] {{h[1,1,1,1],h[1,1,2,2],h[1,1,3,3],h[1,1,1,2],h[1,1,1,3],h[1,1,2,3]}, {h[2,2,1,1],h[2,2,2,2],h[2,2,3,3],h[2,2,1,2],h[2,2,1,3],h[2,2,2,3]}, {h[3,3,1,1],h[3,3,2,2],h[3,3,3,3],h[3,3,1,2],h[3,3,1,3],h[3,3,2,3]}, {h[1,2,1,1],h[1,2,2,2],h[1,2,3,3],h[1,2,1,2],h[1,2,1,3],h[1,2,2,3]}, {h[1,3,1,1],h[1,3,2,2],h[1,3,3,3],h[1,3,1,2],h[1,3,1,3],h[1,3,2,3]}, {h[2,3,1,1],h[2,3,2,2],h[2,3,3,3],h[2,3,1,2],h[2,3,1,3],h[2,3,2,3]}} hth --- jcp