Simplified with Einstein summations.