Small vector and matrix proposed for phobos2 now on github

Gareth Charnock gareth.tpc at gmail.com
Thu Apr 29 16:16:49 PDT 2010


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.



More information about the Digitalmars-d-announce mailing list