[macstl-dev] [ANN] macstl 0.3 -- correction
Glen Low
glen.low at pixelglow.com
Thu Jun 30 08:13:53 WST 2005
Ilya:
On 29/06/2005, at 11:59 PM, Ilya Lipovsky wrote:
> Glen,
>
> Thank you for including my initials in the release announcement. I
> feel somewhat bad, however, that my contribution wasn't in quite
> the domain of added functionality. So, let me correct it a bit by
> suggesting and, actually, providing a unary function "conj" (for
> conjugation):
>
> in functional.h:
>
>
> // added by il at the body, inside namespace impl [begin]
> template <typename T> struct conjugate: public
> std::unary_function <T, T>
> {
> T operator() (const T& lhs) const
> {
> return conj (lhs);
> }
> };
> // added by il [end]
>
> in valarray_base.h:
>
> DEFINE_VALARRAY_UNARY_FUNCTION (conj, conjugate) /* added by il */
>
>
> in vec.h:
>
> DEFINE_VEC_COMMON_UNARY_FUNCTION(conj,stdext,conjugate) /*
> added by il */
>
>
> in impl/vec_altivec.h:
>
> // conjugate - added by il
>
> template <> struct conjugate <macstl::vec <stdext::complex
> <float>, 2> >
> {
> typedef macstl::vec <stdext::complex <float>, 2> argument_type;
> typedef macstl::vec <stdext::complex <float>, 2> result_type;
>
> result_type operator() (const argument_type& lhs) const
> {
> using namespace macstl;
>
> const vec <stdext::complex <float>, 2> conj_filter = vec
> <stdext::complex <float>, 2>::set<0x0000000080000000ULL,
> 0x0000000080000000ULL>();
> return data_cast<result_type>(altivec::vxor (lhs,
> conj_filter));
> }
> };
>
> //----
>
> For NaNs:
> All signaling denormals get converted into signaling denormals.
> All quiet denormals get converted into quiet denormals.
>
> For reals:
> The imaginary parts become negatives of themselves. The real parts
> stay the same.
>
> The above was tested and verified to produce correct results in
> MacSTL v.2.2 - haven't tried your newest, .3, gem yet.
>
> I would like to add more functionality in the future.
Excellent!! This would rate as a * initialled item for 0.3.1 -- BTW,
that's what presents a contributed item in the version history as
Matt LeBlanc's was in 0.3 [*MLe]. Since it also shows you understand
the macstl function extension mechanism, I'm particularly happy.
One minor correction, although I haven't put it through the compiler
yet, is that altivec::vxor should only work on vec <float, 4>, so you
should do a convert to float before that. (Hmm... somewhat unexpected
behavior... )
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pixelglow.com/lists/archive/macstl-dev/attachments/20050630/4558b692/attachment.html
More information about the macstl-dev
mailing list