Sums vs Map efficiency
- To: mathgroup at smc.vnet.net
- Subject: [mg7715] Sums vs Map efficiency
- From: Christophe Pichon <pichon at astro.unibas.ch>
- Date: Wed, 2 Jul 1997 14:21:36 -0400 (EDT)
- Organization: University of Basel, Switzerland
- Sender: owner-wri-mathgroup at wolfram.com
Hello !
Does anyone know how to code the following
in a tensor (more efficient than sums) form ?
here A1 is a (n,n,n)tensor and (A1,A2,a) are n*n matrices
gm=Table[
Sum[ A1[[i,j,k]]*
A2[[i1,k1]]*
a[[i,i1]]* a[[j,j1]]
,{i1,n},{j1,n},{i,n},{j,n}]
,{k,n},{k1,n}]//Flatten;
For some reason in that form it seems to take quite a long time to
process gm. (here a is symbolic a= {{a11,a12...} ... ann}} )
What I am after is an expression involving Map and Thread and
Transpose ... ?
but I tried for a while with little success so far.
Cheers
Christophe
E-mail: pichon at astro.unibas.ch