summaryrefslogtreecommitdiff
path: root/src/include/cctk_Complex.h
Commit message (Collapse)AuthorAge
* This patch makes complex arithmetic in C and C++ more efficient, andschnetter2007-04-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. The patch also appends a type postfix to the names of math functions called in the inlined routines: 'f' for HAVE_CCTK_REAL4, nothing for HAVE_CCTK_REAL8, and 'l' for HAVE_CCTK_REAL16. This avoids compiler warnings about conversions from "double" to "float" which may lose significant bits. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4418 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Patch from Yaakoub to add a complex version of the 'pow' function.goodale2005-01-24
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3966 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Use new HAVE_CCTK_<datatype> macro names.tradke2004-06-26
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3795 17b73243-c579-4c4c-a9d2-2d5706c11dac
* change #if CCTK_HAVE_REAL16 --> #ifdef CCTK_HAVE_REAL16jthorn2004-06-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and similarly for other such #if tests, to avoid warnings from icc: /afs/aei-potsdam.mpg.de/u/jthorn/cactus/Cactus/src/include/cctk_Types.h(32): rem ark #193: zero used for undefined preprocessing identifier #if CCTK_HAVE_REAL16 ^ /afs/aei-potsdam.mpg.de/u/jthorn/cactus/Cactus/src/include/cctk_Complex.h(46): r emark #193: zero used for undefined preprocessing identifier #if CCTK_HAVE_REAL16 ^ [N.b. Harbison & Steele: "C: A Reference Manual", section 3.5.1, states that #if undefined_identifier is equivalent to #if 0 , so so long as we define the symbols with nonzero values when we do define them, #if and #ifdef are equivalent here. But #ifdef is cleaner because * it avoids spurious compiler warnings such as the above * it follows the standard convention for feature-test macros (see, for example, the discussion in the first example of Harbison & Steele's section 3.5.3) and so reduces "programmer surprise" for future maintainence programmers] [Note also that this change is orthogonal to the current discussion on the developers mailing list of what the names of these feature-test macros should be.] git-svn-id: http://svn.cactuscode.org/flesh/trunk@3787 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed typo in macros names in my previous commit: HAVE_CCTK_REAL* should readtradke2004-06-20
| | | | | | | CCTK_HAVE_REAL*. Ditto for CCTK_INT*. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3777 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Use '#if CCTK_HAVE_REAL*' rather than '#ifdef CCTK_REAL*'.tradke2004-06-20
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3775 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix typo.schnetter2003-10-08
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3427 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed typos from last commit.tradke2003-01-07
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3076 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added missing prototypes for CCTK_Cmplx{Sin,Cos,Exp,Sqrt}().tradke2003-01-07
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3075 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Get rid of macro recursions when declaring prototypes of CCTK_COMPLEX routines.tradke2003-01-06
| | | | | | | | | | This fixes known problems with cpp on some platforms (Solaris, Darwin) when preprocessing source code which includes this header file. This closes PR Cactus-1354 and CactusPUGH-1167. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3073 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Undefine NOTHING to avoid compiler warning if this macro gets redefined later.tradke2002-01-02
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2561 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed the complex div() and abs() routines to conform to the GNU Scientific ↵tradke2001-12-12
| | | | | | | | | | | Library. This closes PR Cactus/335. Also added complex exp(), sin(), cos(), and sqrt() routines according to GSL. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2499 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added CCTK complex functions for all possible precisions.tradke2001-02-20
| | | | | | | This closes PR Cactus 411. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2032 17b73243-c579-4c4c-a9d2-2d5706c11dac
* All include files for thorns now have cctk_ then a capital letter (!)allen2000-01-16
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1262 17b73243-c579-4c4c-a9d2-2d5706c11dac