Boost logo

Boost :

Subject: Re: [boost] different matrix library?
From: Edward Grace (ej.grace_at_[hidden])
Date: 2009-08-14 13:23:18


>> but they are handled differently (different public interface)
>> vector is modeled after std::valarray (everybody knows about
>> valarray)
>> and matrix is just a generalization of std::valarray behavior
>> oh and vector is a column-vector
>>
> Just don't name it vector then. In lin. Alg. a vector is a matrix with
> one dimension equal to 1. if not, ppl will wonder why matrix*vector
> doesn't mean what they think it does.

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]
>

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....

-ed


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