Just my 2 cents. It is duplicated code. But it is only 3 lines. "identity" does not need to handle rectangular matrices and non-principal diagonals, therefore it can be reasonably faster (especially for small matrices, I guess).