[Developers] Patch: Make complex arithmetic more efficient and convenient

schnetter at cct.lsu.edu schnetter at cct.lsu.edu
Fri Jan 12 08:59:04 CST 2007


> Number:         2076
> Notify-List:
> Category:       Cactus
> Synopsis:       Patch: Make complex arithmetic more efficient and  
> convenient
> Confidential:   no
> Severity:       non-critical
> Priority:       medium
> Responsible:    goodale
> State:          open
> Class:          feature-request
> Submitter-Id:   user
> Arrival-Date:   Fri Jan 12 08:56:17 -0600 2007
> Originator:     Erik Schnetter
> Release:        Cactus 4.0.b16
> Organization:
> Environment:
> Description:
The enclosed patch makes complex arithmetic in C and C++ more  
efficient, and makes it much more convenient for C++, expecially when  
templates are used.

The flesh functions for complex arithmetic are defined (not only  
declared) by including Complex.c from the header file  
cctk_Complex.h.  They are declared "static inline", so the the  
compiler can inline them, but does not have to create an out-of-line  
copy for every source file.  Complex.c is also compiled stand-alone  
without the "static inline" prefix, so that out-of-line copies exist  
as well.

Add some new complex arithmetic functions, e.g. ComplexNeg to change  
the sign.

Make some complex arithmetic functions more efficient by using  
algorithms from glibc.  These algorithms are LGPL.  They should be  
faster and/or more accurate than the existing implementations.

For C++, define the usual arithmetic operators (+-*/ etc.) as inline  
functions calling the corresponding complex arithmetic functions.   
This makes it possible to use complex numbers in the same way as real  
numbers, which makes it possible to instantiate templates for both  
CCTK_REAL and CCTK_COMPLEX.  This leads to much code reduction in  
Carpet.
> How-To-Repeat:
> Fix:
Unknown
> Unformatted:

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://www.cactuscode.org/pipermail/developers/attachments/20070112/bba276e9/attachment.bin 


More information about the Developers mailing list