Subject: Re: [boost] different matrix library?
From: Edward Grace (ej.grace_at_[hidden])
Date: 2009-08-14 17:28:49
>> 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
> 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
Z = r*ONE + i*IMAG;
where r and i are the scalar real and imaginary components, ONE is
the identity 2x2 matrix,
and IMAG is the anti-symmetric 2x2 matrix
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
For example, if we were to do:
// First template argument is number of dims, second the locations
of the +1 elements.
Z = 3.0*abstract_symmetric_matrix<2,0>() +
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
As another example, the previously quoted:
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
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!
[*] Emphasis since I'm trying to invoke the concept of representation
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk