Computing exponentials and Trig functions

mr.janus at mac.com mr.janus at mac.com
Sat Dec 8 13:25:53 CET 2007


Cheers for all the useful comments.

After further investigation (and some optimisation) my trig functions are actually slightly faster than matlab can do, even when i run at double the precision of matlab.

My problem is that i am calculating trig functions over 2-D matrices. Matlab is able to vectorise it's calculations and so can perform 2-D calculations almost as quickly as it can do a single calculation. When i do the same calculation in my code it is orders of magnitudes slower.

So my new question is is it possible to vectorise GMP calculations (using Altivec or SSE2,3,4) to try and gain some speed advantage over matlab? I have never used vector programming so i don't even now if this is the correct reason for matlab's huge speed advantage.

Many thanks again

Huw

 
On Friday, December 07, 2007, at 08:50PM, "Jim White" <mathimagics at yahoo.co.uk> wrote:
>
>> Still not as satisfying as doing it oneself.
>
>Building one's own wheel from first principles can
>certainly be educational, so I can relate to that. 
>
>It can also be time-consuming, I should add!
> 
>The good folk at MPFR describe their algorithms - you
>will have discovered this if you have visited their
>home page.  Their trig functions are the fastest
>"off-the-shelf" ones available, as you'll see from
>their timings data.
>
>The next fastest (for std trig functions) is CLN, and 
>their approach is certainly worth studying.  The
>primary source document there is a 1997/98 paper by
>Bruno Haible and Thomas Papanikolau (Springer, LNCS
>1423).  
>
>http://www.springerlink.com/content/rw37g65qmb44vfl5/
>
>
>There are also some useful tips, as I recall, in a
>general overview of Elementary Function Algorithms
>that I originally found at yacas.sourceforge.net, and
>I think is till there.
>
>
>Cheers
>
>Jim White
>MSI, ANU
>
>


More information about the gmp-discuss mailing list