[Numpy-svn] r6397 - in branches/coremath/numpy/core: . src
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Feb 18 12:32:09 EST 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 at c@(u) * x / (u - 1);
+ return npy_log2 at c@(u) * x / (u - 1);
}
}
static @type@
exp2_1m at c@(@type@ x)
{
- @type@ u = exp at c@(x);
+ @type@ u = npy_exp at c@(x);
if (u == 1.0) {
return LOGE2*x;
} else if (u - 1 == -1) {
return -LOGE2;
} else {
- return (u - 1) * x/log2 at c@(u);
+ return (u - 1) * x/npy_log2 at c@(u);
}
}
@@ -84,10 +84,10 @@
{
const @type@ tmp = x - y;
if (tmp > 0) {
- return x + log1p at c@(exp at c@(-tmp));
+ return x + npy_log1p at c@(exp at c@(-tmp));
}
else {
- return y + log1p at c@(exp at c@(tmp));
+ return y + npy_log1p at c@(exp at c@(tmp));
}
}
@@ -96,10 +96,10 @@
{
const @type@ tmp = x - y;
if (tmp > 0) {
- return x + log2_1p at c@(exp2 at c@(-tmp));
+ return x + npy_log2_1p at c@(exp2 at c@(-tmp));
}
else {
- return y + log2_1p at c@(exp2 at c@(tmp));
+ return y + npy_log2_1p at c@(exp2 at c@(tmp));
}
}
@@ -261,7 +261,7 @@
if (x->real == 0. && x->imag == 0.)
*r = *x;
else {
- s = sqrt at c@((fabs at c@(x->real) + hypot at c@(x->real,x->imag))/2);
+ s = sqrt at c@((npy_fabs at c@(x->real) + npy_hypot at 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 at c@(c at typ@ *x, c at typ@ *r)
{
- @typ@ l = hypot at c@(x->real,x->imag);
- r->imag = atan2 at c@(x->imag, x->real);
- r->real = log at c@(l);
+ @typ@ l = npy_hypot at c@(x->real,x->imag);
+ r->imag = npy_atan2 at c@(x->imag, x->real);
+ r->real = npy_log at c@(l);
return;
}
static void
nc_log1p at c@(c at typ@ *x, c at typ@ *r)
{
- @typ@ l = hypot at c@(x->real + 1,x->imag);
- r->imag = atan2 at c@(x->imag, x->real + 1);
- r->real = log at c@(l);
+ @typ@ l = npy_hypot at c@(x->real + 1,x->imag);
+ r->imag = npy_atan2 at c@(x->imag, x->real + 1);
+ r->real = npy_log at c@(l);
return;
}
static void
nc_exp at c@(c at typ@ *x, c at typ@ *r)
{
- @typ@ a = exp at c@(x->real);
- r->real = a*cos at c@(x->imag);
- r->imag = a*sin at c@(x->imag);
+ @typ@ a = npy_exp at c@(x->real);
+ r->real = a*npy_cos at c@(x->imag);
+ r->imag = a*npy_sin at c@(x->imag);
return;
}
static void
nc_expm1 at c@(c at typ@ *x, c at typ@ *r)
{
- @typ@ a = exp at c@(x->real);
- r->real = a*cos at c@(x->imag) - 1;
- r->imag = a*sin at c@(x->imag);
+ @typ@ a = npy_exp at c@(x->real);
+ r->real = a*npy_cos at c@(x->imag) - 1;
+ r->imag = a*npy_sin at c@(x->imag);
return;
}
@@ -483,8 +483,8 @@
nc_cos at c@(c at typ@ *x, c at typ@ *r)
{
@typ@ xr=x->real, xi=x->imag;
- r->real = cos at c@(xr)*cosh at c@(xi);
- r->imag = -sin at c@(xr)*sinh at c@(xi);
+ r->real = npy_cos at c@(xr)*npy_cosh at c@(xi);
+ r->imag = -npy_sin at c@(xr)*npy_sinh at c@(xi);
return;
}
@@ -492,8 +492,8 @@
nc_cosh at c@(c at typ@ *x, c at typ@ *r)
{
@typ@ xr=x->real, xi=x->imag;
- r->real = cos at c@(xi)*cosh at c@(xr);
- r->imag = sin at c@(xi)*sinh at c@(xr);
+ r->real = npy_cos at c@(xi)*npy_cosh at c@(xr);
+ r->imag = npy_sin at c@(xi)*npy_sinh at c@(xr);
return;
}
@@ -510,8 +510,8 @@
nc_sin at c@(c at typ@ *x, c at typ@ *r)
{
@typ@ xr=x->real, xi=x->imag;
- r->real = sin at c@(xr)*cosh at c@(xi);
- r->imag = cos at c@(xr)*sinh at c@(xi);
+ r->real = npy_sin at c@(xr)*npy_cosh at c@(xi);
+ r->imag = npy_cos at c@(xr)*npy_sinh at c@(xi);
return;
}
@@ -519,8 +519,8 @@
nc_sinh at c@(c at typ@ *x, c at typ@ *r)
{
@typ@ xr=x->real, xi=x->imag;
- r->real = cos at c@(xi)*sinh at c@(xr);
- r->imag = sin at c@(xi)*cosh at c@(xr);
+ r->real = npy_cos at c@(xi)*npy_sinh at c@(xr);
+ r->imag = npy_sin at c@(xi)*npy_cosh at c@(xr);
return;
}
@@ -531,10 +531,10 @@
@typ@ rs,is,rc,ic;
@typ@ d;
@typ@ xr=x->real, xi=x->imag;
- sr = sin at c@(xr);
- cr = cos at c@(xr);
- shi = sinh at c@(xi);
- chi = cosh at c@(xi);
+ sr = npy_sin at c@(xr);
+ cr = npy_cos at c@(xr);
+ shi = npy_sinh at c@(xi);
+ chi = npy_cosh at 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 at c@(xi);
- ci = cos at c@(xi);
- shr = sinh at c@(xr);
- chr = cosh at c@(xr);
+ si = npy_sin at c@(xi);
+ ci = npy_cos at c@(xi);
+ shr = npy_sinh at c@(xr);
+ chr = npy_cosh at c@(xr);
rs = ci*shr;
is = si*chr;
rc = ci*chr;
More information about the Numpy-svn
mailing list