
On 15 Aug 2009, at 07:28, joel wrote:
Edward Grace wrote:
Err - surely the point of overloading is to assign meaningful context specific behaviour to the same operator, so.
unsigned a,b,c; c = a ^ b; // ^ => XOR makes sense.
pseudovector<3> c; vector<3> a,b; c = a ^ b; // ^ => Wedge product makes sense XOR does not.
Well, except there is use case in computer vision or machien learning in which you have large matrix of integer on which you apply bitwise operation before feeding to some solver. ^ is clearly 'elementwise xor' in this context.
Hmm, is the 'vector' and 'matrix' paradime you have in mind in the same manner as MATLAB? There they seem to be two-faced, they are mathematical vectors and matricies but also just collections of values. Perhaps there needs to be a reasonable distinction between element wise operations and global operations on the object, for instance all the different types of product - Matrix product (* in MATLAB) - Hadamard product (.* in MATLAB) - Kronecker product (kron(A,B) in MATLAB) - Tensor product (tprod MATLAB Mex http://www.mathworks.com/ matlabcentral/fileexchange/16275)
so wedge_product is a better alternative.
Fair enough...
If, for example, b and c were pseudovectors then s would be a (true) scalar and could be assigned to the concrete type double. This is where carrying along some (meta) information concerning the transformation rules of these different entities would be both tricky and crucial. In NT2 matrix of size(1,1) are castable to scalar and such operations works flawlessly.
Hmm, on second thoughts distinguishing between a pseudo<vector/ scalar> and vector/scalar probably doesn't matter for any practical purposes. -ed