Both CPU and GPU version of matrix multiplication