Slightly faster implementation of diagonal elements of matrix product

x %diag% y

Arguments

x

Matrix

y

Matrix