Boost logo

Boost :

From: Erik Wien (wien_at_[hidden])
Date: 2005-03-10 02:31:17


Jason Hise wrote:
> 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?

For what it's worth; If it turns out there is an interest in such a
class, I have already written one (with that exact declaration in fact)
I'd be more that willing to donate to boost. It can currently do
addition, subtraction and multiplication of matrices, as well as provide
functions for a lot of vector and matrix operations like generation of
rotation matrices, taking the length of a vector and so on and so forth.

Just wanted to let you know...

- Erik


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