
for 3d rotation one should consider quaterninons - not a matrix
We're speaking of users land here. They have the right to choose w/e structure they want. Some API requires you to work with matrix to buidl rotations and except some kind of float** later.
Again - back with my oar. As an aside, quaternions can be *represented* [*] as matrices. In the simpler case, consider a complex number: Z = r*ONE + i*IMAG; where r and i are the scalar real and imaginary components, ONE is the identity 2x2 matrix, 1 0 0 1 and IMAG is the anti-symmetric 2x2 matrix 0 -1 1 0 Conjugating a complex number is identically the same as transposing its matrix representation. Quaternions have a similar isomorphism with 4x4 real matrices. So - and I appreciate this is flirting with absurdity, nothing like making a tricky subject more abstract I guess.... Would it be possible to have entirely abstracted matrices, ones that do not contain any numbers, just rules for their combination (multiplication etc)? For example, if we were to do: abstract_matrix<2> Z; // First template argument is number of dims, second the locations of the +1 elements. Z = 3.0*abstract_symmetric_matrix<2,0>() + 4.0*abstract_antisymmetric_matrix<2,1>(); we would end up with a matrix Z that contains just two independent values (3,4) as before but crucially also contains all the rules for its multiplication so that: double length_squared = Z*transpose(Z); is, for example, an entirely valid operation that reduces to length_squared = 3^2+4^2 and has the type of an abstract_symmetric_matrix<2,0> which is identically castable to a scalar. As another example, the previously quoted: transpose(a)*b outer product when applied to a pair of vectors of length 3 will always result in a matrix with 6 independent components (the same number of degrees of freedom that we started with). The resulting matrix (representing a 2 form) is therefore not a general matrix at all. Therefore when using that resulting matrix why should we use up 9 chunks of memory and repeat calculations when we only need to store 6 and can subsequently reduce the number of calculations. Obviously this is a trivial example, but when the matrix is NxN it can be significant. The parting shot is that if one can see through the layers of abstraction there is a real possibility for building a phenomenally efficient linear algebra library that is practically self aware! -ed [*] Emphasis since I'm trying to invoke the concept of representation theory.