I have this R code:
> coef [1] 1.5 2.4 3.9 4.4 > y [,1] [,2] [,3] [,4] [1,] 1 2 12 45 [2,] 5 6 7 8 [3,] 9 10 2 12
This will give you what you want:
t( t(y) * coef )