Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: How to "unflatten"?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83912] Re: How to "unflatten"?
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Tue, 4 Dec 2007 04:25:56 -0500 (EST)
  • References: <fj0rlv$pff$1@smc.vnet.net>

On Dec 3, 4:09 am, Hauke Reddmann <fc3a... at uni-hamburg.de> wrote:
> 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:
> Mab_cd=Partition[Flatten[Sab_cd],4].
>
> 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    fc3a... at uni-hamburg.de
> order stormed the surface where chaos set norm
> had there always been balance? ...surely not
> therein lies the beauty

For the answer to question 1, see the thread "Insulating data from
code" that ran May 16-23, 2006.

http://groups.google.ca/group/comp.soft-sys.math.mathematica/browse_frm/thread/6f294d230f9fd211


  • Prev by Date: Re: FindInstance what inspite ?
  • Next by Date: RE: different eigenvectors
  • Previous by thread: Re: How to "unflatten"?
  • Next by thread: different eigenvectors