Use crossprod() to optimize matrix multiplication