Boost logo

Boost :

Subject: Re: [boost] Review Request: QVM (generic Quaternion, Vector and Matrix operations library)
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2015-08-04 02:26:09


On Mon, Aug 3, 2015 at 7:56 PM, Andrew Hundt <athundt_at_[hidden]> wrote:

> On Mon, May 4, 2015 at 3:06 PM, Emil Dotchevski <emildotchevski_at_[hidden]>
> wrote:
>
> > Boost QVM defines a set of generic functions and operator overloads for
> > working with quaternions, vectors and matrices of static size. The
> library
> > also defines vector and matrix data types, however it allows users to
> > introduce their own types by specializing the q_traits, v_traits and
> > m_traits templates.
> >
> > Online documentation and a link to download the source code under the
> Boost
> > license is available at http://www.revergestudios.com/boost-qvm/.
> >
> > I would like to thank Adam Wulkiewicz for volunteering to be the review
> > manager for QVM and for his valuable initial feedback.
> >
> > Thanks,
> > Emil Dotchevski
> >
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
>
> I was looking at qvm again and I came up with a few additional questions
> and thoughts:
>
> Is it possible to specialize operations to use the underlying library's
> implementation at no (or minimal) performance cost? For example, if both
> matrices in a multiplication are eigen matrices, can the eigen * operator
> be used by the Boost.QVM function call internally?
>

There is no need to specialize anything, if your matrices define any
operations they will be picked by overload resolution (including by
internal QVM functions) since the overloads defined by QVM have a generic
signature and any other overload is considered a better match.

> - Are there STL iterator adaptors? (might have missed them)
>

QVM defines indexing through the ir and iw m_traits function templates, but
if you use 2x2, 3x3 or 4x4 matrices QVM does not use indexing, all reads
and writes are static. In principle iterators could, maybe should be
defined.

> - Could integration with the basic QVM types for some of the most popular
> libraries be included (uBLAS, eigen, armadillo, QMatrix, etc)?
>

Yes, that would be trivial.

> - Have you considered Cube support? (see armadillo for example/explanation
> http://arma.sourceforge.net/)
>
> Cubes are a useful alternative to something like a vector of 4x4 homogenous
> transforms, particularly when combined with 2d views of the 3d object, or
> when you have a number of different matrices with different underlying data
> and the same dimensions. For example 3 matrices that hold R,G,B values of
> an image, or a dense volumetric representation of the world.
>

No, I haven't. I'm not familiar with Cubes so it may or may not make sense
to include with QVM.

> - perhaps a scalar iterator in addition to views? Equivalent to the pixel
> iterator in gil
>
> http://www.boost.org/doc/libs/1_58_0/libs/gil/doc/html/gildesignguide.html#PixelIteratorSectionDG
> views may simply be superior, however.
>

Do you mean similarly to the scalar cast QVM view, except that instead of
type casting a (user-specified) function is called to convert the elements
on request? That seems like a very good idea.

> Examples that would be useful:
>
> - Basic example that does something interesting, see boost.geometry's
> examples for ideas
> - Basic example converting between two different underlying library's types
> and performing an operation on them
> - One liner examples for each of the basic functions, see
> http://en.cppreference.com/w/cpp/algorithm/copy for an idea of what I mean
> - Tutorial on how to implement your own generic algorithm with the library
> with best practices, perhaps SVD
> - How to integrate an algorithm provided by a 3rd party library, such
> Eigen's SVD implementation
> http://eigen.tuxfamily.org/dox/group__SVD__Module.html
> - How to extend QVM with a new type, for example, dual quaternions or the
> various geometric types that exist in conformal geometric algebra, such as
> in versor http://versor.mat.ucsb.edu/#basics

Yes, the documentation does need more examples, thank you for the
suggestions, though I'm a bit worried about adapting general algorithms
since that steps into general linear algebra territory and I do think that
the focus in QVM should remain on, well, Quaternions, Vectors and Matrices.
:)

That said, it does make sense to provide SVD algorithm in QVM; I'm sure
there are a few others like that.

Thank you for the feedback!

-- 
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk