Project DelphiTensors Workshop

Contraction

Contraction — multiply and sum over a shared axis. Spanish: contracción. The dot product is one.

The matrix product is one too. np.einsum writes both directly:

np.einsum('i,i->', a, b) # dot product, sum over i np.einsum('ik,kj->ij', A, B) # matrix product, sum over k

Section 06 is where this becomes a working tool.