Re: Tensor Contraction
- To: mathgroup at smc.vnet.net
- Subject: [mg113787] Re: Tensor Contraction
- From: Erik Max Francis <max at alcyone.com>
- Date: Sat, 13 Nov 2010 00:57:34 -0500 (EST)
- References: <ibj4ol$fi0$1@smc.vnet.net>
Sensei wrote: > Hi! I am trying to implement cleanly the tensor contraction. What I'd > like to do is something like this. > > Let A = matrix of A^{ijk} be a 3-tensor, now how do I write something like > > C^{ik} = A^{ijk} v_j > > using the summing notation? I am trying to avoid making simple For cycles... The way I did it for my own little tensor package is to tensor product the two together, transpose both of the relevant indices you want to contract to the first indices, then run Tr to contract them (call it with Tr[..., Plus, 2]. -- Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/ San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis Mona Lisa / Come to discover / I am your daughter -- Lamya