Boost logo

Boost :

Subject: Re: [boost] different matrix library?
From: joel (joel.falcou_at_[hidden])
Date: 2009-08-15 13:25:16


Edward Grace wrote:
> Well, semantics I know but they are all tensors. A
>
> scalar -> tensor of order 0,
> vector -> a tensor of order 1,
> matrix -> a tensor of order 2. ;-)
Ok back to this. I had a discussionw ith my co-worker on this matter and
our current code state.
Well, in fact, in MATLAB, the concept of LinAlg matrix and of
multi-diemnsional container are merged.
So now, what about the following class set :

- table : matlab like "matrix" ie container of data that can be
N-Dimensions. Only suppot elementwise operations.
- vector/covector : reuse table component for memory management + add
lin. alg. vector semantic. Can be downcasted to table and table can be
explciitly turned into vector/covector baring size macthing.
- matrix : ditto 2D lin. alg. object, interact with vector/covector as
it should. Supprot algebra algorithm. Can have shape etc ...
- tensor : ditto with tensor.

Duck typing + CRTP + lightweight CT inheritance make all these
interoperable.

Leads to nice stuff like :

vector * vector = outer product
covector * vector = scalar product
vector* covector = matrix
matrix*vector and covector*matrix are properly optimized
etc...

What do you htink of this then ?

-- 
___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

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