Matrix multiplication only works on like-typed arguments. Extend it to work more broadly without casts.