|
Boost : |
Subject: Re: [boost] [xint] Boost.XInt formal review
From: Jeremy Maitin-Shepard (jeremy_at_[hidden])
Date: 2011-03-03 13:34:29
On 03/03/2011 05:46 AM, Mathias Gaunard wrote:
> [snip]
> Imagine something similar to the mpn component of the GMP library, but
> with a generic and easy-to-use C++ interface.
> Through genericity, you could make the algorithms accept ranges of
> integers and have them work regardless of digit size, with the digit
> chosen at the discretion of the user. If the user provides a SIMD type
> as a digit, you'll get optimized SIMD code for free, for example, in a
> completely externalized way.
> Now *that* would be awesome.
This whole explicitly passing simd<T> in place of T, which seems to be
the same thing done in nt2, in order to make use of certain
optimizations seems like a poor interface choice. In almost all cases,
the user logically cares about a container of T, and wants to work with
individual elements, and the library should ensure that SIMD operations
are used whenever possible. In particular, the design of the Eigen
library, at least in this respect, seems more appropriate. Perhaps I am
just misinterpreting the intended semantics of using simd<T>, but if it
in fact it results in the logical value_type still being T, then the
question is why you would even need to specify simd at all, rather than
having it always be used. I also don't see how the optimization can be
externalized in the (quite common) case of doing more than element-wise
operations.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk