[Numpy-svn] r6402 - branches/coremath/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Thu Feb 19 02:50:42 CST 2009


Author: cdavid
Date: 2009-02-19 02:50:33 -0600 (Thu, 19 Feb 2009)
New Revision: 6402

Modified:
   branches/coremath/numpy/core/src/npy_math.c.src
Log:
Decorate all the math functions, make internal replacements static.

Modified: branches/coremath/numpy/core/src/npy_math.c.src
===================================================================
--- branches/coremath/numpy/core/src/npy_math.c.src	2009-02-19 08:50:13 UTC (rev 6401)
+++ branches/coremath/numpy/core/src/npy_math.c.src	2009-02-19 08:50:33 UTC (rev 6402)
@@ -56,7 +56,7 @@
 
 /* Original code by Konrad Hinsen.  */
 #ifndef HAVE_EXPM1
-double expm1(double x)
+static double expm1(double x)
 {
     double u = exp(x);
     if (u == 1.0) {
@@ -70,7 +70,7 @@
 #endif
 
 #ifndef HAVE_LOG1P
-double log1p(double x)
+static double log1p(double x)
 {
     double u = 1. + x;
     if (u == 1.0) {
@@ -82,7 +82,7 @@
 #endif
 
 #ifndef HAVE_HYPOT
-double hypot(double x, double y)
+static double hypot(double x, double y)
 {
     double yx;
 
@@ -103,14 +103,14 @@
 #endif
 
 #ifndef HAVE_ACOSH
-double acosh(double x)
+static double acosh(double x)
 {
     return 2*log(sqrt((x+1.0)/2)+sqrt((x-1.0)/2));
 }
 #endif
 
 #ifndef HAVE_ASINH
-double asinh(double xx)
+static double asinh(double xx)
 {
     double x, d;
     int sign;
@@ -132,7 +132,7 @@
 #endif
 
 #ifndef HAVE_ATANH
-double atanh(double x)
+static double atanh(double x)
 {
     if (x > 0) {
         return -0.5*log1p(-2.0*x/(1.0 + x));
@@ -144,7 +144,7 @@
 #endif
 
 #ifndef HAVE_RINT
-double rint(double x)
+static double rint(double x)
 {
     double y, r;
 
@@ -166,7 +166,7 @@
 #endif
 
 #ifndef HAVE_TRUNC
-double trunc(double x)
+static double trunc(double x)
 {
     return x < 0 ? ceil(x) : floor(x);
 }
@@ -174,7 +174,7 @@
 
 #ifndef HAVE_EXP2
 #define LOG2 0.69314718055994530943
-double exp2(double x)
+static double exp2(double x)
 {
     return exp(LOG2*x);
 }
@@ -183,7 +183,7 @@
 
 #ifndef HAVE_LOG2
 #define INVLOG2 1.4426950408889634074
-double log2(double x)
+static double log2(double x)
 {
     return INVLOG2*log(x);
 }
@@ -247,7 +247,7 @@
 #undef @kind@@c@
 #endif
 #ifndef HAVE_@KIND@@C@
-@type@ @kind@@c@(@type@ x)
+static @type@ @kind@@c@(@type@ x)
 {
     return (@type@) @kind@((double)x);
 }
@@ -263,7 +263,7 @@
 #undef @kind@@c@
 #endif
 #ifndef HAVE_@KIND@@C@
-@type@ @kind@@c@(@type@ x, @type@ y)
+static @type@ @kind@@c@(@type@ x, @type@ y)
 {
     return (@type@) @kind@((double)x, (double) y);
 }
@@ -274,7 +274,7 @@
 #undef modf@c@
 #endif
 #ifndef HAVE_MODF@C@
-@type@ modf@c@(@type@ x, @type@ *iptr)
+static @type@ modf@c@(@type@ x, @type@ *iptr)
 {
     double niptr;
     double y = modf((double)x, &niptr);
@@ -284,3 +284,39 @@
 #endif
 
 /**end repeat**/
+
+/*
+ * Decorate all the functions: those are the public ones
+ */
+
+/**begin repeat
+ * #type = npy_longdouble,double,float#
+ * #c = l,,f#
+ */
+/**begin repeat1
+ * #kind = sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,rint,trunc,sqrt,log10,
+ *         log,exp,expm1,asin,acos,atan,asinh,acosh,atanh,log1p,exp2,log2#
+ */
+
+@type@ npy_@kind@@c@(@type@ x)
+{
+    return @kind@@c@(x);
+}
+
+/**end repeat1**/
+
+/**begin repeat1
+ * #kind = atan2,hypot,pow,fmod#
+ */
+@type@ npy_@kind@@c@(@type@ x, @type@ y)
+{
+    return @kind@@c@(x, y);
+}
+/**end repeat1**/
+
+@type@ npy_modf@c@(@type@ x, @type@ *iptr)
+{
+    return modf@c@(x, iptr);
+}
+
+/**end repeat**/



More information about the Numpy-svn mailing list