[Numpy-svn] r6183 - in branches/numpy-mingw-w64: . doc numpy/core/src numpy/core/tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Dec 21 02:08:12 EST 2008
Author: cdavid
Date: 2008-12-21 01:08:03 -0600 (Sun, 21 Dec 2008)
New Revision: 6183
Modified:
branches/numpy-mingw-w64/
branches/numpy-mingw-w64/doc/Makefile
branches/numpy-mingw-w64/numpy/core/src/umath_funcs_c99.inc.src
branches/numpy-mingw-w64/numpy/core/tests/test_umath.py
Log:
Merged revisions 6174-6175,6179-6182 via svnmerge from
http://svn.scipy.org/svn/numpy/trunk
........
r6174 | ptvirtan | 2008-12-20 02:58:57 +0900 (Sat, 20 Dec 2008) | 1 line
docs: put CHM files in a zip
........
r6175 | ptvirtan | 2008-12-20 22:40:30 +0900 (Sat, 20 Dec 2008) | 1 line
test_umath: don't check against cmath on branch cuts, since the behavior of our functions varies across platforms on them
........
r6179 | cdavid | 2008-12-21 15:02:29 +0900 (Sun, 21 Dec 2008) | 1 line
Do not declare missing functions to avoid mismatch with potentially conflicting, undetected ones
........
r6180 | cdavid | 2008-12-21 15:02:44 +0900 (Sun, 21 Dec 2008) | 1 line
Update comments in umath.
........
r6181 | cdavid | 2008-12-21 15:03:05 +0900 (Sun, 21 Dec 2008) | 1 line
Do not set function to macro in umath anymore.
........
r6182 | cdavid | 2008-12-21 15:03:19 +0900 (Sun, 21 Dec 2008) | 1 line
Do not define math func as static: better to have a link error when we have a config problem than having two functions with the same name.
........
Property changes on: branches/numpy-mingw-w64
___________________________________________________________________
Name: svnmerge-integrated
- /branches/distutils-revamp:1-2752 /branches/dynamic_cpu_configuration:1-6101 /branches/multicore:1-3687 /branches/visualstudio_manifest:1-6077 /trunk:1-6149
+ /branches/distutils-revamp:1-2752 /branches/dynamic_cpu_configuration:1-6101 /branches/multicore:1-3687 /branches/visualstudio_manifest:1-6077 /trunk:1-6182
Modified: branches/numpy-mingw-w64/doc/Makefile
===================================================================
--- branches/numpy-mingw-w64/doc/Makefile 2008-12-21 06:03:19 UTC (rev 6182)
+++ branches/numpy-mingw-w64/doc/Makefile 2008-12-21 07:08:03 UTC (rev 6183)
@@ -42,7 +42,7 @@
perl -pi -e 's#^\s*(<li><a href=".*?">NumPy.*?Manual.*?»</li>)#<li><a href="/">Numpy and Scipy Documentation</a> »</li>#;' build/dist/*.html build/dist/*/*.html build/dist/*/*/*.html
cd build/html && zip -9r ../dist/numpy-html.zip .
cp build/latex/numpy-*.pdf build/dist
- -cp build/htmlhelp/numpy.chm build/dist
+ -zip build/dist/numpy-chm.zip build/htmlhelp/numpy.chm
cd build/dist && tar czf ../dist.tar.gz *
chmod ug=rwX,o=rX -R build/dist
find build/dist -type d -print0 | xargs -0r chmod g+s
Modified: branches/numpy-mingw-w64/numpy/core/src/umath_funcs_c99.inc.src
===================================================================
--- branches/numpy-mingw-w64/numpy/core/src/umath_funcs_c99.inc.src 2008-12-21 06:03:19 UTC (rev 6182)
+++ branches/numpy-mingw-w64/numpy/core/src/umath_funcs_c99.inc.src 2008-12-21 07:08:03 UTC (rev 6183)
@@ -17,9 +17,7 @@
* can be linked from the math library. The result can depend on the
* optimization flags as well as the compiler, so can't be known ahead of
* time. If the function can't be linked, then either it is absent, defined
- * as a macro, or is an intrinsic (hardware) function. If it is linkable it
- * may still be the case that no prototype is available. So to cover all the
- * cases requires the following construction.
+ * as a macro, or is an intrinsic (hardware) function.
*
* i) Undefine any possible macros:
*
@@ -27,44 +25,20 @@
* #undef foo
* #endif
*
- * ii) Check if the function was in the library, If not, define the
- * function with npy_ prepended to its name to avoid conflict with any
- * intrinsic versions, then use a define so that the preprocessor will
- * replace foo with npy_foo before the compilation pass. Make the
- * function static to avoid poluting the module library.
+ * ii) Avoid as much as possible to declare any function here. Declaring
+ * functions is not portable: some platforms define some function inline
+ * with a non standard identifier, for example, or may put another
+ * idendifier which changes the calling convention of the function. If you
+ * really have to, ALWAYS declare it for the one platform you are dealing
+ * with:
*
- * #ifdef foo
- * #undef foo
- * #endif
- * #ifndef HAVE_FOO
- * static double
- * npy_foo(double x)
- * {
- * return x;
- * }
- * #define foo npy_foo
+ * Not ok:
+ * double exp(double a);
*
- * iii) Finally, even if foo is in the library, add a prototype. Just being
- * in the library doesn't guarantee a prototype in math.h, and in any case
- * you want to make sure the prototype is what you think it is. Count on it,
- * whatever can go wrong will go wrong. Think defensively! The result:
- *
- * #ifdef foo
- * #undef foo
- * #endif
- * #ifndef HAVE_FOO
- * static double
- * npy_foo(double x)
- * {
- * return x;
- * }
- * #define foo npy_foo
- * #else
- * double foo(double x);
- * #end
- *
- * And there you have it.
- *
+ * Ok:
+ * #ifdef SYMBOL_DEFINED_WEIRD_PLATFORM
+ * double exp(double);
+ * #endif
*/
/*
@@ -82,8 +56,7 @@
/* Original code by Konrad Hinsen. */
#ifndef HAVE_EXPM1
-static double
-npy_expm1(double x)
+double expm1(double x)
{
double u = exp(x);
if (u == 1.0) {
@@ -94,14 +67,10 @@
return (u-1.0) * x/log(u);
}
}
-#define expm1 npy_expm1
-#else
-double expm1(double x);
#endif
#ifndef HAVE_LOG1P
-static double
-npy_log1p(double x)
+double log1p(double x)
{
double u = 1. + x;
if (u == 1.0) {
@@ -110,14 +79,10 @@
return log(u) * x / (u - 1);
}
}
-#define log1p npy_log1p
-#else
-double log1p(double x);
#endif
#ifndef HAVE_HYPOT
-static double
-npy_hypot(double x, double y)
+double hypot(double x, double y)
{
double yx;
@@ -135,25 +100,17 @@
return x*sqrt(1.+yx*yx);
}
}
-#define hypot npy_hypot
-#else
-double hypot(double x, double y);
#endif
#ifndef HAVE_ACOSH
-static double
-npy_acosh(double x)
+double acosh(double x)
{
return 2*log(sqrt((x+1.0)/2)+sqrt((x-1.0)/2));
}
-#define acosh npy_acosh
-#else
-double acosh(double x);
#endif
#ifndef HAVE_ASINH
-static double
-npy_asinh(double xx)
+double asinh(double xx)
{
double x, d;
int sign;
@@ -172,14 +129,10 @@
}
return sign*log1p(x*(1.0 + x/(d+1)));
}
-#define asinh npy_asinh
-#else
-double asinh(double xx);
#endif
#ifndef HAVE_ATANH
-static double
-npy_atanh(double x)
+double atanh(double x)
{
if (x > 0) {
return -0.5*log1p(-2.0*x/(1.0 + x));
@@ -188,14 +141,10 @@
return 0.5*log1p(2.0*x/(1.0 - x));
}
}
-#define atanh npy_atanh
-#else
-double atanh(double x);
#endif
#ifndef HAVE_RINT
-static double
-npy_rint(double x)
+double rint(double x)
{
double y, r;
@@ -214,46 +163,31 @@
}
return y;
}
-#define rint npy_rint
-#else
-double rint(double x);
#endif
#ifndef HAVE_TRUNC
-static double
-npy_trunc(double x)
+double trunc(double x)
{
return x < 0 ? ceil(x) : floor(x);
}
-#define trunc npy_trunc
-#else
-double trunc(double x);
#endif
#ifndef HAVE_EXP2
#define LOG2 0.69314718055994530943
-static double
-npy_exp2(double x)
+double exp2(double x)
{
return exp(LOG2*x);
}
-#define exp2 npy_exp2
#undef LOG2
-#else
-double exp2(double x);
#endif
#ifndef HAVE_LOG2
#define INVLOG2 1.4426950408889634074
-static double
-npy_log2(double x)
+double log2(double x)
{
return INVLOG2*log(x);
}
-#define log2 npy_log2
#undef INVLOG2
-#else
-double log2(double x);
#endif
/*
@@ -331,14 +265,10 @@
#undef @kind@@c@
#endif
#ifndef HAVE_ at KIND@@C@
-static @type@
-npy_ at kind@@c@(@type@ x)
+ at type@ @kind@@c@(@type@ x)
{
return (@type@) @kind@((double)x);
}
-#define @kind@@c@ npy_ at kind@@c@
-#else
- at type@ @kind@@c@(@type@ x);
#endif
/**end repeat1**/
@@ -351,14 +281,10 @@
#undef @kind@@c@
#endif
#ifndef HAVE_ at KIND@@C@
-static @type@
-npy_ at kind@@c@(@type@ x, @type@ y)
+ at type@ @kind@@c@(@type@ x, @type@ y)
{
return (@type@) @kind@((double)x, (double) y);
}
-#define @kind@@c@ npy_ at kind@@c@
-#else
- at type@ @kind@@c@(@type@ x, @type@ y);
#endif
/**end repeat1**/
@@ -366,17 +292,13 @@
#undef modf at c@
#endif
#ifndef HAVE_MODF at C@
-static @type@
-npy_modf at c@(@type@ x, @type@ *iptr)
+ at type@ modf at c@(@type@ x, @type@ *iptr)
{
double niptr;
double y = modf((double)x, &niptr);
*iptr = (@type@) niptr;
return (@type@) y;
}
-#define modf at c@ npy_modf at c@
-#else
- at type@ modf at c@(@type@ x, @type@ *iptr);
#endif
/**end repeat**/
Modified: branches/numpy-mingw-w64/numpy/core/tests/test_umath.py
===================================================================
--- branches/numpy-mingw-w64/numpy/core/tests/test_umath.py 2008-12-21 06:03:19 UTC (rev 6182)
+++ branches/numpy-mingw-w64/numpy/core/tests/test_umath.py 2008-12-21 07:08:03 UTC (rev 6183)
@@ -404,7 +404,7 @@
if sys.version_info < (2,5,3):
broken_cmath_asinh = True
- points = [-2, 2j, 2, -2j, -1-1j, -1+1j, +1-1j, +1+1j]
+ points = [-1-1j, -1+1j, +1-1j, +1+1j]
name_map = {'arcsin': 'asin', 'arccos': 'acos', 'arctan': 'atan',
'arcsinh': 'asinh', 'arccosh': 'acosh', 'arctanh': 'atanh'}
atol = 4*np.finfo(np.complex).eps
More information about the Numpy-svn
mailing list