if you go with Matx23d, set coeffs using
<pre>
Matx23d coeffs(matM.ptr<double>());
</pre>
no loop is needed