Re: [eigen] two decisions to take

```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 :)

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

> or better:
>
> 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 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
objection was.

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

I assume that by "wedge" you mean: x wedge y = x * transpose(y). I disagree
with operator^ meaning wedge for vectors of size different from 3. If
operator^ means wedge for any size, then it should mean wedge for all sizes.
For size 3, wedge is different from cross, as wedge gives a 3x3 matrix while
cross gives a vector. So there would be a big consistency issue.

Besides, Eigen2 will let you do x * transpose(y) for any vectors x,y and
obtain the result as an expression template. Indeed, Eigen2 treats vectors as
matrices with 1 column, so you will be able to apply transpose() to a vector
and get a "horizontal vector".

> Please, implement infix operators, not prefix operators.

I agree that it's better, when possible.

> If you absolutely need prefix operators, please, please put them in the
> eigen2 namespace so they don't pollute the global namespace.

Of course everything in the Eigen namespace, as an additional measure. But I
don't regard this as an important protection against pollution, as many
people will want to "using namespace".

The main protection against pollution is that the global operators that I
define always take eigen-specific types as arguments. That, I think, is
really effective. At worst it makes the life of the compiler a bit harder

> We can always use setCross/^= vs. cross/^ to mean assignment operation vs
> return value operation.

I don't think there is any use case. That kind of thing was very useful in
Eigen1 because we had to fight to avoid returning objects by value. In
Eigen2, we can do w = u ^ v without overhead. As to the case when one
actually wants to do u = u ^ v, I think that it is very uncommon.

But yes, we can add ^= if you see a use case (and if we all agree on ^ for
cross product).

Benoit
```

Attachment: signature.asc
Description: This is a digitally signed message part.

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/