
on 15.08.2009 at 21:25 joel wrote :
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 ?
to me it's a lot better now -- Pavel