### Mat per-element operation: vector-matrix multiplication

**I** is an *mxn* matrix and each element of **I** is a *1x3* vector (**I** is a 3-channel Mat image actually).

**M** is a *3x3* matrix.

**J** is an matrix having the same dimension as **I** and is computed as follows: each element of **J** is the vector-matrix product of the corresponding (i.e. having the same coordinates) element of **I** and **M**.

I.e. if *v1(r1,g1,b1)* is an element of **I** and *v2(r2,g2,b2)* is its corresponding element of **J**, then *v2* = *v1* * **M** (this is a vector-matrix product, not a per-element product).

Question: How to compute **J** efficiently (in terms of speed)?

Thank you for your help.