My preference for [[1,0],[0,1]] has nothing to do with space.
When the matrix calculations I want to do are intended to be
exact, it would be disastrously wrong for the identity matrix
to be made of floats.
When they are intended to be approximate, an integer identity
matrix is harmless.
It’s rather nice that integer matrix addition and multiplication
are associative, which floating-point matrix addition and
multiplication are not.
If I were concerned about space, I’d represent a known 2x2 matrix
as {A,B,C,D} rather than [[A,B],[C,D]].
I see it; I expect to manage mostly approximate computations, whose native inputs are already floats (actually integers only happen when entering by hand test case matrices like in the previous unit test).
As for {A,B,C,D} versus [[A,B],[C,D]], indeed I use the latter (less compact yet flexible) form, only for matrices of arbitrary dimensions. Otherwise, e.g. for a matrix known to be 4x4, it is the former tuple-based special-cased form that is used (precisely as a record, the extra tag allowing to introduce multiple “flavours” of such matrices: matrix4 and compact_matrix4, typically to deal with homogeneous ones), together with the ‘identity_4’ atom, to account for a quite frequent default value.
One interested in efficient, battle-tested, linear operations in Erlang should definitively have a look at Wings3D, which concentrates so much knowledge also in terms of wx, OpenGL, etc.