|Re: [eigen] two decisions to take|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
Benoît Jacob wrote:
On Tuesday 04 September 2007 19:47:18 Schleimer, Ben wrote:
I disagree. I think that eigen2 should be using methods instead of global
functions because it's a C++ toolkit.
It's not a big deal adding member functions. In Eigen1 we allowed both
dot(v,w) and v.dot(w), so I think we'll do the same in Eigen2, since there
seems to be strong advocates of both approaches :)
fine, as long as the global dot or cross functions are present (of
course inside eigen's namespace), i have no objections against member
functions. if it is well documented that those change the value of the
FYI I've implemented the matrix-matrix and matrix-vector operator* as a
global, and I don't think this is a problem since as Andre said the compiler
will resolve that overloading and call this operator* only when appropriate.
double zLen = x^y*n*3;
(the ^ is the cross operator and the * is the dot operator. For vectors not
of dim3, ^ should be the wedge operator)
I won't give operator* the additional meaning of dot product. It already has 4
meanings (matrix-matrix, matrix-vector, matrix-scalar, vector-scalar
products), this is enough!
i had operator* in my own little small veclib as dot product for a long
time, but now i follow the way blitz++ and tvmet and do NOT give it the
meaning of a dot-product. there are many good arguments doing so, but i
forgot them ;-) (somewhere on the blitz++ mailing list)
I agree with the operator^ for cross product, actually I proposed it one year
ago on #eigen for Eigen1 but someone objected. I don't remember what the
If we go for operator^ for cross product, then I suggest operator| for dot
product. This is classical mathematical notation, especially in quantum
mechanics (Dirac's "bras" and "kets").
too bad c++ cannot overload the dot-operator... but well, if "|" is that
well known in quantum mechanics (to be honest, never seen that use, do
you have some link / pdf showing that?), it sounds fine to overload it
for dot product.
kind regards, andre!
p.s. i am very excited about the upcoming new eigen! thanks for all your
efforts, benoit ! i like your way of "keep it as simple as possible". so
maybe even c++ noobs like me will have a chance to understand the magic
behind expression templates. or at least get the rough idea.