Hello,
I am trying to find the optimal contraction for:
M_{ij} = \sum_{prsq} C_{pi} C_{qj} T_{prsq} C_{ri} C_{sj} = \sum_{prsq} T_{prsq} C_{pi} C_{qj} C_{ri} C_{sj}
where T_{prsq} is an N\times N \times N \times N tensor and C_{ab} is an N\times N tensor…
It seems like the following is possible:
Complete contraction: pi,qj,prsq,ri,sj->ij
--------------------------------------------------------------------------------
scaling BLAS current remaining
--------------------------------------------------------------------------------
3 0 ri,pi->rip qj,prsq,sj,rip->ij
3 0 sj,qj->sjq prsq,rip,sjq->ij
5 TDOT rip,prsq->isq sjq,isq->ij
4 TDOT isq,sjq->ij ij->ij
--------------------------------------------------------------------------------
However, I was wondering if there is a better way given the fact that the C matrices above are all the same.
Thanks for any help!