One term per tensor, with one letter per axis and equal lengths for equal letters, and explicit output letters must be distinct and occur in an input
The numeric tensors, with an empty term for a number
const multi = Chalkboard.tens.einsum("ij,jk->ik", [[1, 2], [3, 4]], [[5, 6], [7, 8]]); // Returns [[19, 22], [43, 50]]
const trace = Chalkboard.tens.einsum("ii", [[1, 2], [3, 4]]); // Returns 5
const cross = Chalkboard.tens.einsum("ijk,j,k->i", Chalkboard.tens.LeviCivita(3), [1, 2, 3], [4, 5, 6]); // Returns [-3, 6, -3]
Calculates Einstein summation using case-sensitive axis letters, commas, and an optional -> output, ignoring whitespace. Repeated letters select diagonals or contractions, but without an explicit output, letters occurring exactly once are kept in character-code order. Ellipses and broadcasting are not supported.