Re: [eigen] problem with colwise/cross product

[ Thread Index | Date Index | More Archives ]

2009/1/5 Timothy Hunter <tjhunter@xxxxxxxxxxxx>:
> Hello all,
> I have column vectors packed in a matrix and I want to perform
> cross-product on each of these vectors. I thought of using the
> .colwise method but it fails to compile.
> Example code:
> Vector3f v;
> Matrix3f M, M2;
> M2 = M.colwise().cross(v);

This is not a bug, it's a lack of feature!
colwise() returns a proxy object on which only a few functions are
defined. cross() is not defined because we just didn't anticipate that
somebody would use that.

It's no biggy to implement, so I do it and I update you.

> On an other topic, I experimented a bit with interfacing Eigen with
> python. My version of swig cannot even parse the code (it does not
> understand template syntax like foo. template method<T>() ). I have
> some proof of concept code using Boost.Python that loads Eigen as a
> Python module, but I would like to get the slicing to work before
> presenting something. Is anyone interested?

If you interface Eigen with python, it is very very important to
understand that you _don't_ want all the template logic of Eigen to
run at runtime in a python interpreter -- that would be far too heavy.
So you don't need to worry about making swig or boost understand all
the code inside Eigen. The expression templates should be hidden from
python. Instead, what is sensible to do, is to interface the plain
matrix and vector classes, making all methods/operators return plain
matrices and vectors, not expressions. In this way you can have a
Python interface to a nice part of Eigen's API. I'm not sure that you
can get all of the API though,since stuff like
m.row(i).segment(start,length) += some_other_vector;
relies heavily on expression templates, but i'm not familiar with
Python so there might be a way to recover part of that (probably not
all of the API though).

Tim Vandermeersch already did some Python interface to part of Eigen
for the Avogadro project. I think he reads this list but anyway his
address is: tim dot vandermeersch gmail com

> Happy new year 2009!

Happy 2009 to you too,



Mail converted by MHonArc 2.6.19+