Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-03-09 22:57:38


I saw that boost already has a pretty impressive linear algebra suite,
with many specialized types of matrices. Though these are all very
useful, I was wondering if there might be room for one more type of
matrix: one which makes each size of matrix a unique type (I did not
see such a matrix in the docs, but please correct me if I overlooked it
and it does already exist). Using such matrices, it would be possible
to validate the legality of certain operations at compile time (for
instance, only matrices of compatible sizes can be multiplied). A very
stripped down version of the class might look like this:

template < typename T, unsigned int X, unsigned int Y >
class matrix
{
    // maintains Y rows, each containing X Ts internally
};

template < typename T, unsigned int X, unsigned int Y, unsigned int Z >
matrix < T, Z, Y > operator * ( const Matrix < T, X, Y > & lhs, const
Matrix < T, Z, X > & rhs );
// multiplication defined only for compatible matrices

Is there any interest in such a class?

-Jason


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk