Re: [eigen] problem with colwise/cross product |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] problem with colwise/cross product
- From: "Benoit Jacob" <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 5 Jan 2009 14:32:49 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=r2uGCyk2fHnZcL/HT80XeBezYaiPTql5m02ug+ULBsI=; b=JflSrumrQulI7JnMs3UjWB4Hde1PrADCjwAR6u+HSR9NQ2xfdB15vFUmFCh0XDpEhQ MbwCGpFh1Wfazt06j9TAOTagvpTWYLYUOcACBBPZPTuMU8A4w6hqTuWZTui99OQbY5GH 6Mg0mao5bzUg4PUSPCeQFqMtlMxDbOFai5YyY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=ngcYssI0m7wBi9USMHGRawSzCjt50lVaS3U/Fjc/JWL5f7rNMeuUwYykJ6c1+CKzqn weq3s8LGPn8htRWUR1ePBFeVGS0sJ9U6lnaT9pedUctjX0IfJbXiMiBsP3zytjhdznaB N4awQd10IIiF8N6cCumtn6++d3VXHS9a+sHaM=
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,
Cheers,
Benoit
---