Last year I had to multiply a nxn matrix by another nxn matrix that has only one row. I lost like a week to write the correct @guvectorize spell in numpy to make that multiplication faster than the usual multiplication.
Protip: "optimize=True" is equivalent to "optimize='greedy'", but you may prefer "optimize='optimal'" for big cases or use a list precalculated by einsum_path.