Re: tensor product
- To: mathgroup at smc.vnet.net
- Subject: [mg61749] Re: [mg61738] tensor product
- From: Pratik Desai <pdesai1 at umbc.edu>
- Date: Fri, 28 Oct 2005 03:25:27 -0400 (EDT)
- References: <200510270954.FAA20757@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
André Hautot wrote: >In quantum physics one often needs the matrix representation of tensor >products > >Outer[Times,{{1,2},{3,4}},{{a,b},{c,d}}]//MatrixForm > >outputs something like this: > >{{{{a,b},{c,d}},{{2a,2b},{2c,2d}},{{{3a,3b},{3c,3d}},{{4a,4b},{4c,4d}}}} > >what I need is > >{{a,b,2a,2b},{c,d,2c,2d},{3a,3b,4a,4b},{3c,3d,4c,4d}} > >How to get this? > >Thanks in advance > >ahautot at ulg.ac.be > > > > > How about some thing like this Clear[a, b, c, d] mata = {{1, 2}, {3, 4}} matb = {{a, b}, {c, d}} Partition[Flatten[Table[Flatten[Outer[Times, mata[[ s]], matb[[k]]]], {s, 1, 2, 1}, {k, 1, 2, 1}]], 4] // MatrixForm I am sure there is a more simpler way to doing this Hope this helps Pratik . -- Pratik Desai Graduate Student UMBC Department of Mechanical Engineering Phone: 410 455 8134
- References:
- tensor product
- From: André Hautot <AHautot@ulg.ac.be>
- tensor product