inner product of a matrix