Small vector and matrix proposed for phobos2 now on github
"Jérôme M. Berger"
jeberger at free.fr
Fri Apr 30 14:23:33 PDT 2010
Robert Jacques wrote:
> On Thu, 29 Apr 2010 19:16:49 -0400, Gareth Charnock
> <gareth.tpc at gmail.com> wrote:
>
>> Jérôme M. Berger wrote:
>>> Gareth Charnock wrote:
>>>> PS: Okay so I just had a looked at the matrix and vector classes in
>>>> Ogre3D and irrlicht. Looks like they both define v*v as element wise
>>>> multiplication but m*m is matrix multiplication. That just seems even
>>>> more inconsistent.
>>> Eigen (http://eigen.tuxfamily.org/ ) uses '*' for the matrix
>>> multiplication. v*v is an error (incompatible shapes). Element wise
>>> operations can be done like this: v.cwise()*v
>>> Jerome
>> That's an very impressive looking library if even half of what they
>> claim is true. I can't believe I've missed this for so long (found the
>> boost matrix library, blitz++, the matrix template library, FLENS,
>> something called armadillo but not eigen. I do believe all my C++
>> linear algebra woes are over.
>>
>> Eigen seems to treat vectors as 1 by n matrices and if you do this you
>> get the matrix-vector product and the dot product for free as these
>> are all the same operation. Probably v^T*v would be the dot product.
>> Expression templates should make these operations efficient.
>>
>
> Actually, express templates, though they give nice syntax result in a
> lot of temporaries, which hurt performance. Check out Don's BLADE
> library and the associated talks and posts.
According to the documentation, Eigen expression templates do not
result in temporaries, except for multiplication. And even then, you
can remove the temporaries by using the .lazy function in Eigen2 or
the .noalias() function in the upcoming Eigen3:
http://eigen.tuxfamily.org/dox-devel/Eigen2ToEigen3.html#LazyVsNoalias
An yes, it is very impressive :) and very comfortable to use. I had
seen about the same selection as you before discovering Eigen and
moving to it. The only drawback is that it currently doesn't
multithread.
Jerome
--
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20100430/59fff5f3/attachment.pgp>
More information about the Digitalmars-d-announce
mailing list