I would store M as a vector of static arrays since one dimension (3) is known and fixed. This will probably speed things up quite a lot.
See my previous answer here for a similar situation
I would store M as a vector of static arrays since one dimension (3) is known and fixed. This will probably speed things up quite a lot.
See my previous answer here for a similar situation