Boost logo

Boost :

From: Jens Seidel (jensseidel_at_[hidden])
Date: 2007-12-06 15:13:36


On Thu, Dec 06, 2007 at 07:37:51PM +0100, Andreas Harnack wrote:
> shouldn't there be at least an elementary matrix class available
> in the standard? I notice there have been some discussions in
> the past, but there doesn't seem to be anything in the pipeline.
> So, is there any interest in a (really!) light weight statically
> typed matrix template class? I'm thinking of something like:

> template<typename T, unsigned int M, unsigned int N>
> class matrix

a few days ago I started exactly as you described (except that I used
old style for loops instead of STL stuff :-) a TinyDenseMatrix class
to implement the Moore Penrose pseudo inverse for real tiny matrices
(4 x n, n<20).

A very big disadvantage is using fixed dimensions. There is no need for
memory allocation in this case but it restricts the usage dramatically!

Nearly always the dimensions are variables, there are only a few rare
cases where you know these before. So how about making N and M variables
and providing one or two good memory allocators?

> T* data() { return &**m; }

Why not &m[0][0]?

> The advantage of this approach is its simplicity, in fact, it's

Right, I wrote such stuff already multiple times even if I care normally
about sparse matrices with dimensions > 1 000 000.


Boost list run by bdawes at, gregod at, cpdaniel at, john at