Dear Julia,
What is the best way to rewrite the following code from Python to Julia?
def ctwa(U, B, J, F):
# B shape, (n,m)
# U shape, (n,m)
# J shape, (n,n,m,m)
# F shape, (m,m,m)
BUF = np.einsum(‘jb,jc,abc->ja’,B,U,F)
JU = np.einsum(‘jlbc,lb->jbc’,J,U)
JUUF = np.einsum(‘jbc,jc,abc->ja’,JU,U,F)
return BUF + JUUF
Regards
JV