Re: [eigen] sse asin implementation |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] sse asin implementation
- From: Rohit Garg <rpg.314@xxxxxxxxx>
- Date: Tue, 31 Mar 2009 22:08:15 +0530
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=BonUl0gxuzWVPA0z+YFyk9Oq+X/wdOHxJq4WIDiADD8=; b=PSLJMBNvfF4e4WfRK9A8RqYeOw0THTYwt4lQBDkwsCkD3JwuikB8U3QPkDIalNXV88 sQ3XRIMZhuxVFkbw/UnnbrxZQtNcbTt4vcYDsKlK8fYoV7GE8vCbBRolv3fpQtri5tN2 w5mJmqjOFMGju55rCxu9s77grYm2apDbqkQ3A=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ppGiH5KBDVAUGvHFJ139p8GVXBdqCEYxcAxbEgxt5Ux/d/RNpESP/NselkFO+QoksT SGKEp4u3T/xvN5FrbqEmZD12HMJouS7RHOiurZDD9aCogrO/IlDBFnp3FC8ODXCdybv4 eODz+x8nlZfUVeW1HZMgR54e+93W7xK5aLDhk=
For general exponentiation, I think a cheap and easy route would be
just exp(b*log(a))
I looked at the cephes library implementation of pow and they do a lot
of hacks just to get 3 bits of precision. In the use case that you
have cited, I think it's better to just have the above implementation.
It is certainly good enough for the -ffast-math case.
BTW, what do you think of enabling the fast math paths in eigen when
just -ffast-math is supplied to gcc. It can be detected by the
__FAST_MATH__ macro.
On Tue, Mar 31, 2009 at 9:47 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> 2009/3/31 Rohit Garg <rpg.314@xxxxxxxxx>:
>>> As I said, there's at least one very useful function that's not yet
>>> vectorized: pow.
>>
>> You are looking towards Packet4f pow(Packet4f a, Packet4f b) right?
>
> Yes, exactly. Actually, I think that in most cases b would be just a
> scalar, however if you implement the above, we'll get that by passing
> a constant packet as b.
>
> If it makes things faster / easier, I'd say don't hesitate to go for
> Packet4f pow(Packet4f a, float b)
> instead. This would then be called when the user does
>
> result_vector = vector.cwise().pow(b); // where b is a float.
>
> Cheers,
> Benoit
>
>>
>>
>> --
>> Rohit Garg
>>
>> http://rpg-314.blogspot.com/
>>
>> Senior Undergraduate
>> Department of Physics
>> Indian Institute of Technology
>> Bombay
>>
>>
>>
>
>
>
--
Rohit Garg
http://rpg-314.blogspot.com/
Senior Undergraduate
Department of Physics
Indian Institute of Technology
Bombay