MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to "unflatten"?

  • To: mathgroup at
  • Subject: [mg83884] How to "unflatten"?
  • From: Hauke Reddmann <fc3a501 at>
  • Date: Mon, 3 Dec 2007 07:09:06 -0500 (EST)

Excuse a complete noob's question:

I do calculations with S matrices and need to convert
the tensor form Sab_cd (which would be e.g. the nested
list {{{{,},{,}},{{,},{,}}},{{{,},{,}},{{,},{,}}}} -
I omitted variables a1-a16, since only the structure
of the list, a 2*2*2*2 nest, is relevant) into a
matrix Mab_cd: {{,,,},{,,,},{,,,},{,,,}}. That is trivial:

But how to reverse the process? Of course even I already
can write a quadruple loop S[[,,,]]=M[,] with direct
handover of elements, but that is so unelegant, especially
as I have to apply this a hundred times in the computation
(and can't write subroutines yet, I'm a noob after all :-)

Question 2: I could skip the whole converting if I knew
how to do an Einstein sum over two indices inside a tensor: 
Sab_cd -> Sab_ca -> sum(a=1,n,Sab_ca) -> Tb_c.
At the moment I do this whith "blocking" multiple indices
into a matrix and then do the matrix product, but this is
more a clever hack. 
Hauke Reddmann <:-EX8    fc3a501 at
order stormed the surface where chaos set norm
had there always been balance? ...surely not
therein lies the beauty

  • Prev by Date: Re: Hiding number cell
  • Next by Date: Re: Hiding number cell
  • Previous by thread: Re: Re: Presentations Package Announcement
  • Next by thread: Re: How to "unflatten"?