
on 14.08.2009 at 21:23 Edward Grace wrote :
Just to stick my oar in -- there is also a subtle difference between a covector and a vector. This rarely seems to get a look-in when people implement linear algebra stuff. They may well be represented as a tuple in both cases but they interact differently. For example. covector*vector = scalar [inner product] vector*covector = tensor [outer product] Usually they are represented as columns (vectors) and rows (covectors).
a) 1 2 3
b) 1 2 3
a*b = 14 (inner product) b*a = 1 2 3 2 4 6 3 6 9 (outer product) [N.B. there are still only 6 independent components] well if we consider a vector to be a column vector then inner product will be
http://en.wikipedia.org/wiki/ Einstein_notation#Common_operations_in_this_notation It would be great if these objects could be made to 'do the right thing', MATLAB does, mostly (it's MAT lab after all not TENS lab). Being able to write stuff like: vector w,u,v; // They are all (column) vectors. ... w = levi_civita*u*v; and get out the conventional cross product u x v when u and v have length 3, as a special case of exterior products, or, w = wedge(u,v); // Wedge product, function form w = u ^ v; // Wedge product operator form. Though I'm not sure it has the right precedence properties... would be pretty neat. I'll go away and hide now.... unfortunately i think in linalg domain (you think in tensor domain i guess) so we may misanderstand each other in the end i think it's possible to attach a mechanism to support tensor style operations by the way w = u ^ v; it's terribly wrong to overload '^' in such a way
transpose(vector)*vector //covector*vector; actually here we //get 1x1 matrix and outer product vector*transpose(vector) //vector*covector since a vector is actually a matrix we can transpose it the following is much MUCH more better solution:
w = wedge(u,v);
-- Pavel