Completed function that multiplies matrix by a vector