I saw this commit recently: rB01c75c3765eb305b1a99b794c1d40ad224b071c6
When digging into the code I was surprised that in many (all?) cases a full inverse of a 4x4 matrix is calculated although that is not really necessary. Very often additional knowledge can make calculating the inverse easier. E.g. most matrices that are inverted are just transformation/affine matrices, so the fourth row is just (0 0 0 1).
This patch includes two utility math functions for matrix inversion. I did not test them extensively yet (mainly because I don't know a good way to test them in Blenders source code atm...). First I wanted to ask if this is something that should be included into Blender.
It might also be possible to find a better inversion function for matrices that just contain translation, rotation and scale (no shearing etc).
https://math.stackexchange.com/questions/152462/inverse-of-transformation-matrix