Contracting More Than One Level in Tensor Products
- To: mathgroup at smc.vnet.net
- Subject: [mg35830] Contracting More Than One Level in Tensor Products
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 2 Aug 2002 02:42:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
If we want to contract two tensor arrays S and T in Mathematica we can write
S.T. We could also use the Inner product. This will contract the last level
of S with the first level of T.
I would like to know how to contract more than one pair of levels. Suppose S
and T are 3rd order tensors and I want to contract the last two levels of S
with the first two levels of T. How can I do that?
Or suppose I wanted to contract all three levels. For example with...
Smat = Array[S, {3, 3, 3}]
Tmat = Array[T, {3, 3, 3}]
I would like to obtain the answer...
Smat Transpose[Tmat, {3, 2, 1}]
Plus @@ Flatten[%]
but by a more general method. That is, I would like to contract any number
of adjacent levels in two tensors.
Thanks for any guidance on this.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/