|
Boost : |
Subject: Re: [boost] Review Request: QVM (generic Quaternion, Vector and Matrix operations library)
From: Emil Dotchevski (emil_at_[hidden])
Date: 2015-05-07 15:49:26
On Thu, May 7, 2015 at 5:55 AM, David Bellot <david.bellot_at_[hidden]> wrote:
> >
> > Me: Just #include this and use types called floatvec2 and floatmat2x2
> > and + and * just work.
> >
>
> âmy cosmetic and artistic opinion about that:
> â
> âwith ublas, you can do that:â
>
> â#include <boost/
> ânumeric/ublas/matrix.hpp>
>
> // this is not needed but it's useful to have them
> â#include <boost/
> ânumeric/ublas/io.hpp>
> â#include <boost/
> ânumeric/ublas/assignment.hpp>
>
> âint main()
> {
> fixed_matrix<double,3,3> m1;
>
> m1 <<= 1,2,3
> 4,5,6,
> 7,8,9;
>
> cout << m1 << endl;
> }
>
> And personally, I find fixed_matrix<double,3,3> to be easier to remember
> and more explicit to use than floatvec2 or dblmat2x2 or whatever else. And
> I don't have to look into the doc, if I can't remember if the matrix name
> was DblMat2x2 or double_mat2_2... or Matrix2D ? (no, it's not the same
> library).
>
Perhaps I'm missing something in the ublas design -- please someone correct
me if I'm wrong that in ublas operator overloads (e.g. matrix
multiplication) are defined as members of various ublas types that have
matrix semantics. QVM uses a different approach: it defines *only*
namespace-scope operator overloads that then work on any type with matrix
semantics.
So yes, you might or might not prefer fixed_matrix<double,3,3> to double33
or dblmat3x3 -- QVM is neutral to such preferences. It just gives you the
relevant operations for whatever types you might have on your hands.
Thanks,
Emil
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk