@halirutan my version in the post is a special treatment of 2x2, using direct formula. According to my googleing, it is a general consensus, for inversion or something else, matrix below 4x4, using direct formula is efficient. For general LU decomposition, a self written version is efficient if the dimension is below 10. here is benchmark I did month ago,
postimg.org/image/l9ofl2hkh the green is fortran calling intel lapack, the others are routines I write.