[Numpy-svn] r6397 - in branches/coremath/numpy/core: . src

numpy-svn@scip... numpy-svn@scip...
Wed Feb 18 11:32:09 CST 2009


Author: cdavid
Date: 2009-02-18 11:32:02 -0600 (Wed, 18 Feb 2009)
New Revision: 6397

Modified:
   branches/coremath/numpy/core/setup.py
   branches/coremath/numpy/core/src/umath_funcs.inc.src
Log:
Use npymath instead of C math lib for umath_funcs (break numpy ATM).

Modified: branches/coremath/numpy/core/setup.py
===================================================================
--- branches/coremath/numpy/core/setup.py	2009-02-18 17:31:27 UTC (rev 6396)
+++ branches/coremath/numpy/core/setup.py	2009-02-18 17:32:02 UTC (rev 6397)
@@ -411,6 +411,7 @@
                                     join('*.py')
                                     ],
                          depends = deps,
+                         libraries=['npymath'],
                          )
 
     config.add_extension('umath',
@@ -428,6 +429,7 @@
                                     generate_umath_py,
                                     join(codegen_dir,'generate_ufunc_api.py'),
                                     ]+deps,
+                         libraries=['npymath'],
                          )
 
     config.add_extension('scalarmath',

Modified: branches/coremath/numpy/core/src/umath_funcs.inc.src
===================================================================
--- branches/coremath/numpy/core/src/umath_funcs.inc.src	2009-02-18 17:31:27 UTC (rev 6396)
+++ branches/coremath/numpy/core/src/umath_funcs.inc.src	2009-02-18 17:32:02 UTC (rev 6397)
@@ -62,20 +62,20 @@
     if (u == 1) {
         return LOG2E*x;
     } else {
-        return log2@c@(u) * x / (u - 1);
+        return npy_log2@c@(u) * x / (u - 1);
     }
 }
 
 static @type@
 exp2_1m@c@(@type@ x)
 {
-    @type@ u = exp@c@(x);
+    @type@ u = npy_exp@c@(x);
     if (u == 1.0) {
         return LOGE2*x;
     } else if (u - 1 == -1) {
         return -LOGE2;
     } else {
-        return (u - 1) * x/log2@c@(u);
+        return (u - 1) * x/npy_log2@c@(u);
     }
 }
 
@@ -84,10 +84,10 @@
 {
     const @type@ tmp = x - y;
     if (tmp > 0) {
-        return x + log1p@c@(exp@c@(-tmp));
+        return x + npy_log1p@c@(exp@c@(-tmp));
     }
     else {
-        return y + log1p@c@(exp@c@(tmp));
+        return y + npy_log1p@c@(exp@c@(tmp));
     }
 }
 
@@ -96,10 +96,10 @@
 {
     const @type@ tmp = x - y;
     if (tmp > 0) {
-        return x + log2_1p@c@(exp2@c@(-tmp));
+        return x + npy_log2_1p@c@(exp2@c@(-tmp));
     }
     else {
-        return y + log2_1p@c@(exp2@c@(tmp));
+        return y + npy_log2_1p@c@(exp2@c@(tmp));
     }
 }
 
@@ -261,7 +261,7 @@
     if (x->real == 0. && x->imag == 0.)
         *r = *x;
     else {
-        s = sqrt@c@((fabs@c@(x->real) + hypot@c@(x->real,x->imag))/2);
+        s = sqrt@c@((npy_fabs@c@(x->real) + npy_hypot@c@(x->real,x->imag))/2);
         d = x->imag/(2*s);
         if (x->real > 0) {
             r->real = s;
@@ -289,36 +289,36 @@
 static void
 nc_log@c@(c@typ@ *x, c@typ@ *r)
 {
-    @typ@ l = hypot@c@(x->real,x->imag);
-    r->imag = atan2@c@(x->imag, x->real);
-    r->real = log@c@(l);
+    @typ@ l = npy_hypot@c@(x->real,x->imag);
+    r->imag = npy_atan2@c@(x->imag, x->real);
+    r->real = npy_log@c@(l);
     return;
 }
 
 static void
 nc_log1p@c@(c@typ@ *x, c@typ@ *r)
 {
-    @typ@ l = hypot@c@(x->real + 1,x->imag);
-    r->imag = atan2@c@(x->imag, x->real + 1);
-    r->real = log@c@(l);
+    @typ@ l = npy_hypot@c@(x->real + 1,x->imag);
+    r->imag = npy_atan2@c@(x->imag, x->real + 1);
+    r->real = npy_log@c@(l);
     return;
 }
 
 static void
 nc_exp@c@(c@typ@ *x, c@typ@ *r)
 {
-    @typ@ a = exp@c@(x->real);
-    r->real = a*cos@c@(x->imag);
-    r->imag = a*sin@c@(x->imag);
+    @typ@ a = npy_exp@c@(x->real);
+    r->real = a*npy_cos@c@(x->imag);
+    r->imag = a*npy_sin@c@(x->imag);
     return;
 }
 
 static void
 nc_expm1@c@(c@typ@ *x, c@typ@ *r)
 {
-    @typ@ a = exp@c@(x->real);
-    r->real = a*cos@c@(x->imag) - 1;
-    r->imag = a*sin@c@(x->imag);
+    @typ@ a = npy_exp@c@(x->real);
+    r->real = a*npy_cos@c@(x->imag) - 1;
+    r->imag = a*npy_sin@c@(x->imag);
     return;
 }
 
@@ -483,8 +483,8 @@
 nc_cos@c@(c@typ@ *x, c@typ@ *r)
 {
     @typ@ xr=x->real, xi=x->imag;
-    r->real = cos@c@(xr)*cosh@c@(xi);
-    r->imag = -sin@c@(xr)*sinh@c@(xi);
+    r->real = npy_cos@c@(xr)*npy_cosh@c@(xi);
+    r->imag = -npy_sin@c@(xr)*npy_sinh@c@(xi);
     return;
 }
 
@@ -492,8 +492,8 @@
 nc_cosh@c@(c@typ@ *x, c@typ@ *r)
 {
     @typ@ xr=x->real, xi=x->imag;
-    r->real = cos@c@(xi)*cosh@c@(xr);
-    r->imag = sin@c@(xi)*sinh@c@(xr);
+    r->real = npy_cos@c@(xi)*npy_cosh@c@(xr);
+    r->imag = npy_sin@c@(xi)*npy_sinh@c@(xr);
     return;
 }
 
@@ -510,8 +510,8 @@
 nc_sin@c@(c@typ@ *x, c@typ@ *r)
 {
     @typ@ xr=x->real, xi=x->imag;
-    r->real = sin@c@(xr)*cosh@c@(xi);
-    r->imag = cos@c@(xr)*sinh@c@(xi);
+    r->real = npy_sin@c@(xr)*npy_cosh@c@(xi);
+    r->imag = npy_cos@c@(xr)*npy_sinh@c@(xi);
     return;
 }
 
@@ -519,8 +519,8 @@
 nc_sinh@c@(c@typ@ *x, c@typ@ *r)
 {
     @typ@ xr=x->real, xi=x->imag;
-    r->real = cos@c@(xi)*sinh@c@(xr);
-    r->imag = sin@c@(xi)*cosh@c@(xr);
+    r->real = npy_cos@c@(xi)*npy_sinh@c@(xr);
+    r->imag = npy_sin@c@(xi)*npy_cosh@c@(xr);
     return;
 }
 
@@ -531,10 +531,10 @@
     @typ@ rs,is,rc,ic;
     @typ@ d;
     @typ@ xr=x->real, xi=x->imag;
-    sr = sin@c@(xr);
-    cr = cos@c@(xr);
-    shi = sinh@c@(xi);
-    chi = cosh@c@(xi);
+    sr = npy_sin@c@(xr);
+    cr = npy_cos@c@(xr);
+    shi = npy_sinh@c@(xi);
+    chi = npy_cosh@c@(xi);
     rs = sr*chi;
     is = cr*shi;
     rc = cr*chi;
@@ -552,10 +552,10 @@
     @typ@ rs,is,rc,ic;
     @typ@ d;
     @typ@ xr=x->real, xi=x->imag;
-    si = sin@c@(xi);
-    ci = cos@c@(xi);
-    shr = sinh@c@(xr);
-    chr = cosh@c@(xr);
+    si = npy_sin@c@(xi);
+    ci = npy_cos@c@(xi);
+    shr = npy_sinh@c@(xr);
+    chr = npy_cosh@c@(xr);
     rs = ci*shr;
     is = si*chr;
     rc = ci*chr;



More information about the Numpy-svn mailing list