partial contract

Hi,

I have a simple question. Maybe this question is duplicate, but I can’t find any same question.

Can ITensor calculate the following summation?

A_{ n } = SUM_{ m } B_{m, n} C_{m, n}

If I do simple tensor contraction, then
A = B*C → A is scalar

But I don’t want to sum ‘n’ index.

Thank you a lot any answer!

This is the most convenient way to do that operation right now in ITensor:

using ITensors
m = Index(2)
n = Index(2)
B = randomITensor(m, n)
C = randomITensor(m, n)
A = prime(B, n) * prime(C, 2, n) * delta(n', n'', n)
1 Like

Thank you!!