
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