[Numpy-svn] r5913 - in trunk: . numpy/core numpy/core/include/numpy numpy/core/src numpy/distutils/command

numpy-svn@scip... numpy-svn@scip...
Sun Oct 5 03:28:55 CDT 2008


Author: cdavid
Date: 2008-10-05 03:28:42 -0500 (Sun, 05 Oct 2008)
New Revision: 5913

Added:
   trunk/numpy/core/src/math_c99.inc.src
Removed:
   trunk/numpy/core/src/_isnan.c
Modified:
   trunk/
   trunk/numpy/core/SConscript
   trunk/numpy/core/include/numpy/ufuncobject.h
   trunk/numpy/core/setup.py
   trunk/numpy/core/src/_signbit.c
   trunk/numpy/core/src/umathmodule.c.src
   trunk/numpy/distutils/command/config.py
Log:
Merged revisions 5737-5912 via svnmerge from 
http://svn.scipy.org/svn/numpy/branches/clean_math_config

................
  r5738 | cdavid | 2008-09-01 21:18:52 +0900 (Mon, 01 Sep 2008) | 3 lines
  
  Initialized merge tracking via "svnmerge" with revisions "1-5737" from 
  http://svn.scipy.org/svn/numpy/trunk
................
  r5756 | cdavid | 2008-09-04 22:49:42 +0900 (Thu, 04 Sep 2008) | 1 line
  
  Add a math_c99 compatibility module.
................
  r5757 | cdavid | 2008-09-04 22:58:47 +0900 (Thu, 04 Sep 2008) | 1 line
  
  Add float and long double functions (C99).
................
  r5758 | cdavid | 2008-09-04 23:35:51 +0900 (Thu, 04 Sep 2008) | 1 line
  
  Use code generator for c99_math.c
................
  r5759 | cdavid | 2008-09-04 23:37:29 +0900 (Thu, 04 Sep 2008) | 1 line
  
  move C99 math stuff to a .src file.
................
  r5760 | cdavid | 2008-09-04 23:40:00 +0900 (Thu, 04 Sep 2008) | 1 line
  
  Add expm1 function in c99 compat module.
................
  r5761 | cdavid | 2008-09-04 23:45:33 +0900 (Thu, 04 Sep 2008) | 4 lines
  
  Use C99 math compatibility module.
  
  Completely broken for now, needs to update the configuration stage.
................
  r5762 | cdavid | 2008-09-04 23:55:01 +0900 (Thu, 04 Sep 2008) | 66 lines
  
  Merged revisions 5738-5761 via svnmerge from 
  http://svn.scipy.org/svn/numpy/trunk
  
  ........
    r5739 | cdavid | 2008-09-01 21:50:46 +0900 (Mon, 01 Sep 2008) | 1 line
    
    Disable memmap test which crashes nose tests on cygwin.
  ........
    r5740 | cdavid | 2008-09-01 22:07:30 +0900 (Mon, 01 Sep 2008) | 2 lines
    
    Fix unused variable warning in object_arrtype_new.
  ........
    r5741 | cdavid | 2008-09-02 15:59:43 +0900 (Tue, 02 Sep 2008) | 5 lines
    
    Fix regression test #771 on 64 bits architecture.
    
    The test assumed an item was 4 bytes. Use itemsize instead of harcoding 4 bytes
    per item.
  ........
    r5742 | jarrod.millman | 2008-09-03 05:13:17 +0900 (Wed, 03 Sep 2008) | 2 lines
    
    pulling out testing docs from distutils docs
  ........
    r5743 | jarrod.millman | 2008-09-03 05:32:38 +0900 (Wed, 03 Sep 2008) | 2 lines
    
    reindenting prior to release
  ........
    r5745 | jarrod.millman | 2008-09-03 08:52:37 +0900 (Wed, 03 Sep 2008) | 2 lines
    
    trunk is open for 1.3 development
  ........
    r5748 | alan.mcintyre | 2008-09-03 14:10:39 +0900 (Wed, 03 Sep 2008) | 3 lines
    
    Fix __init__.py boilerplate example in DISTUTILS.txt, and moved content from 
    SciPy wiki entry on testing guidelines to TESTS.txt.
  ........
    r5749 | alan.mcintyre | 2008-09-03 15:11:28 +0900 (Wed, 03 Sep 2008) | 3 lines
    
    Updated TESTS.txt to actually be ReST.
    Capitalization nitpickery in DISTUTILS.txt: 'Scipy' -> 'SciPy'
  ........
    r5750 | alan.mcintyre | 2008-09-03 16:49:59 +0900 (Wed, 03 Sep 2008) | 2 lines
    
    Added section discussing using subclassing to create similar tests.
  ........
    r5751 | pierregm | 2008-09-04 01:48:52 +0900 (Thu, 04 Sep 2008) | 1 line
    
    docstring update
  ........
    r5752 | cdavid | 2008-09-04 01:54:37 +0900 (Thu, 04 Sep 2008) | 1 line
    
    Start a nep for warn-free numpy build.
  ........
    r5753 | cdavid | 2008-09-04 22:31:24 +0900 (Thu, 04 Sep 2008) | 1 line
    
    Update the warnfix nep.
  ........
    r5754 | cdavid | 2008-09-04 22:36:53 +0900 (Thu, 04 Sep 2008) | 1 line
    
    Start a nep for cleaning the math configuration.
  ........
    r5755 | cdavid | 2008-09-04 22:49:01 +0900 (Thu, 04 Sep 2008) | 1 line
    
    Update clean math config nep.
  ........
................
  r5763 | cdavid | 2008-09-05 00:12:45 +0900 (Fri, 05 Sep 2008) | 1 line
  
  put the setup code to check for match cap in a separate function.
................
  r5764 | cdavid | 2008-09-05 00:31:57 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Check for non-mandatory, basic, double functions.
................
  r5765 | cdavid | 2008-09-05 00:32:29 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Do not build math_c99.c, only set it as a dependency.
................
  r5766 | cdavid | 2008-09-05 00:39:38 +0900 (Fri, 05 Sep 2008) | 5 lines
  
  Manually generate math_c99.c
  
  I did not find a way to generate math_c99.c from math_c99.src with distutils,
  so let's include the generated file for now.
................
  r5767 | cdavid | 2008-09-05 01:29:09 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Keep the cruft for compatibility for now.
................
  r5773 | cdavid | 2008-09-05 12:12:37 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Check for all float/long double C99 math funcs explicitely.
................
  r5774 | cdavid | 2008-09-05 12:15:25 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Use calling version of check func.
................
  r5775 | cdavid | 2008-09-05 12:19:04 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Use the way formely used by setup to set backward-compatible defines.
................
  r5776 | cdavid | 2008-09-05 14:37:06 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Tell vim to recognize umathmodule.c.src as a C file.
................
  r5777 | cdavid | 2008-09-05 14:44:39 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Add fmod and modf as mandatory functions.
................
  r5778 | cdavid | 2008-09-05 14:49:32 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Add frexp and ldexp as the functions to lookf for C99 versions.
................
  r5779 | cdavid | 2008-09-05 15:11:26 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Add a check_funcs_once function to speed up func checks.
................
  r5780 | cdavid | 2008-09-05 15:21:18 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Use check_funcs_once to speed-up configuration on sane platforms.
................
  r5781 | cdavid | 2008-09-05 15:25:57 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Speed up the math configuration using check_funcs_once.
................
  r5782 | cdavid | 2008-09-05 15:34:55 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Fix indentation.
................
  r5783 | cdavid | 2008-09-05 15:47:10 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Remove HAVE_FLOAT_FUNCS, and use function-specific HAVE_ instead.
................
  r5784 | cdavid | 2008-09-05 15:47:40 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Remove HAVE_INVERSE_* for inverse hyperbolic funcs: not needed anymore.
................
  r5785 | cdavid | 2008-09-05 15:49:48 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Check for isnan and isinf.
................
  r5786 | cdavid | 2008-09-05 15:59:44 +0900 (Fri, 05 Sep 2008) | 1 line
  
  Do not check for the same functions twice.
................
  r5787 | cdavid | 2008-09-05 16:00:12 +0900 (Fri, 05 Sep 2008) | 1 line
  
  ldexp is a mandatory function.
................
  r5812 | cdavid | 2008-09-13 16:04:41 +0900 (Sat, 13 Sep 2008) | 105 lines
  
  Merged revisions 5762-5811 via svnmerge from 
  http://svn.scipy.org/svn/numpy/trunk
  
  ........
    r5768 | ptvirtan | 2008-09-05 03:04:35 +0900 (Fri, 05 Sep 2008) | 1 line
    
    Ufunc docstrings: show the 'out' arguments in a more standard way
  ........
    r5769 | alan.mcintyre | 2008-09-05 03:23:48 +0900 (Fri, 05 Sep 2008) | 4 lines
    
    Replaced numpy.testing.decorators.skipknownfailure with knownfailureif, 
    which allows flagging tests as known failures rather than skips.
    Updated test_umath to use knownfailureif.
  ........
    r5770 | alan.mcintyre | 2008-09-05 06:13:29 +0900 (Fri, 05 Sep 2008) | 2 lines
    
    Renamed classes to conform to PEP 8.
  ........
    r5771 | alan.mcintyre | 2008-09-05 07:06:01 +0900 (Fri, 05 Sep 2008) | 2 lines
    
    Fix link to example.py.
  ........
    r5772 | alan.mcintyre | 2008-09-05 10:20:09 +0900 (Fri, 05 Sep 2008) | 2 lines
    
    Remove debugging code.
  ........
    r5788 | dhuard | 2008-09-05 22:58:00 +0900 (Fri, 05 Sep 2008) | 1 line
    
    Applied patch from R. May fixing ticket #905 (loadtxt). Fixed other bug occurring when both usecols and converters are provided. Added related regression tests.
  ........
    r5789 | oliphant | 2008-09-05 23:06:02 +0900 (Fri, 05 Sep 2008) | 1 line
    
    Add final date-time proposal.
  ........
    r5791 | pierregm | 2008-09-06 08:38:44 +0900 (Sat, 06 Sep 2008) | 1 line
    
    * fixed deepcopy of masked arrays (bug #906)
  ........
    r5793 | cdavid | 2008-09-07 16:16:28 +0900 (Sun, 07 Sep 2008) | 8 lines
    
    scons command: fix one more issue related to build dir.
    
    The distutils installation directory relative to the scons build directory was
    not always computed right. The relative position on the fs does not depend on
    the source directory (in out-of-place builds), but on the package *name*
    translated to a directly only.
  ........
    r5796 | pearu | 2008-09-09 19:55:30 +0900 (Tue, 09 Sep 2008) | 1 line
    
    Fix typo.
  ........
    r5797 | stefan | 2008-09-09 22:38:34 +0900 (Tue, 09 Sep 2008) | 2 lines
    
    FIX: Loadtxt raises on empty input (closes #908).
  ........
    r5799 | alan.mcintyre | 2008-09-10 02:48:47 +0900 (Wed, 10 Sep 2008) | 2 lines
    
    Removed unused imports.
  ........
    r5800 | pierregm | 2008-09-10 03:25:15 +0900 (Wed, 10 Sep 2008) | 1 line
    
    * make sure that minimum & maximum actually return a MaskedArray
  ........
    r5803 | pierregm | 2008-09-12 04:54:31 +0900 (Fri, 12 Sep 2008) | 1 line
    
    * fixed view for MaskedArrays w/ flexible dtype
  ........
    r5804 | jarrod.millman | 2008-09-13 04:20:26 +0900 (Sat, 13 Sep 2008) | 2 lines
    
    FIX: broken links
  ........
    r5805 | jarrod.millman | 2008-09-13 04:23:20 +0900 (Sat, 13 Sep 2008) | 2 lines
    
    FIX: broken links
  ........
    r5806 | alan.mcintyre | 2008-09-13 11:53:53 +0900 (Sat, 13 Sep 2008) | 2 lines
    
    Fix failing doctests.
  ........
    r5807 | alan.mcintyre | 2008-09-13 11:56:33 +0900 (Sat, 13 Sep 2008) | 2 lines
    
    Remove unused imports.
  ........
    r5808 | alan.mcintyre | 2008-09-13 12:40:57 +0900 (Sat, 13 Sep 2008) | 7 lines
    
    Removed unused/duplicate imports.
    Removed repeated members of __all__.
    Fixed reference to undefined "out" in functions.py:take function.
    Fixed references to undefined "N" in functions.py.
    Rewrapped lines to conform to PEP8.
    Fixed references to undefined FPE_* constants (from numpy) in util.py.
  ........
    r5809 | cdavid | 2008-09-13 15:03:30 +0900 (Sat, 13 Sep 2008) | 6 lines
    
    Fix cygwin compilation
    
    Recent version of binutils (2.18.50) do not accept 4 bytes operand for some
    opcodes like fnstsw (which always expected a 2 bytes operand). Replace the type
    of the argument from unsigned 2 bytes to unsigned 4 bytes unsigned integer.
  ........
    r5810 | cdavid | 2008-09-13 15:27:46 +0900 (Sat, 13 Sep 2008) | 1 line
    
    Tag ctypes load library tests as known failures on cygwin.
  ........
................
  r5813 | cdavid | 2008-09-13 16:16:32 +0900 (Sat, 13 Sep 2008) | 1 line
  
  Detect declaration of isnan and co only.
................
  r5814 | cdavid | 2008-09-13 16:25:51 +0900 (Sat, 13 Sep 2008) | 1 line
  
  Clean IEEE handling: define them as macro.
................
  r5815 | cdavid | 2008-09-13 16:27:25 +0900 (Sat, 13 Sep 2008) | 1 line
  
  Update generated math_c99 compat module.
................
  r5816 | cdavid | 2008-09-13 16:28:08 +0900 (Sat, 13 Sep 2008) | 1 line
  
  Remove trailing spaces.
................
  r5817 | cdavid | 2008-09-13 16:30:07 +0900 (Sat, 13 Sep 2008) | 1 line
  
  remove unused _isnan.c
................
  r5818 | cdavid | 2008-09-13 16:48:29 +0900 (Sat, 13 Sep 2008) | 1 line
  
  Fix typo in setup.py
................
  r5819 | cdavid | 2008-09-13 17:08:16 +0900 (Sat, 13 Sep 2008) | 1 line
  
  Do not depend on _isnan.c.
................
  r5820 | cdavid | 2008-09-13 17:09:02 +0900 (Sat, 13 Sep 2008) | 1 line
  
  Rename signbit replacement to signbit_d to avoid clash between macro and function.
................
  r5836 | cdavid | 2008-09-20 17:22:25 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Include Python.h before math.h for declaration tests in mathlib.
................
  r5837 | cdavid | 2008-09-20 17:47:19 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Remove the generated math_c99.c file from svn; generate it automatically from setup.py.
................
  r5838 | cdavid | 2008-09-20 18:48:01 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Test for MSVC, because we will need to special case for this F***** compiler once again.
................
  r5839 | cdavid | 2008-09-20 19:05:52 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Assume mandatory funcs available with MSVC.
................
  r5840 | cdavid | 2008-09-20 19:18:59 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Fix typo in CPP define.
................
  r5841 | cdavid | 2008-09-20 19:49:01 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Undef macro when using replacement functions in math_c99 module.
................
  r5842 | cdavid | 2008-09-20 19:51:35 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Forgot to define M_PI if not available.
................
  r5843 | cdavid | 2008-09-20 19:53:27 +0900 (Sat, 20 Sep 2008) | 1 line
  
  Forgot to define float/long double version of log1p if not available on the platform.
................
  r5844 | cdavid | 2008-09-20 20:39:20 +0900 (Sat, 20 Sep 2008) | 78 lines
  
  Merged revisions 5812-5843 via svnmerge from 
  http://svn.scipy.org/svn/numpy/trunk
  
  ........
    r5821 | alan.mcintyre | 2008-09-14 03:04:57 +0900 (Sun, 14 Sep 2008) | 3 lines
    
    Removed unused imports.
    Standardize NumPy import as "import numpy as np".
  ........
    r5822 | alan.mcintyre | 2008-09-14 03:10:48 +0900 (Sun, 14 Sep 2008) | 6 lines
    
    Rewrapped __all__ definition to conform to PEP8.
    Standardize NumPy import as "import numpy as np".
    Removed unused imports.
    Fixed undefined reference to ndarray (should be np.ndarray).
    Fixed undefined references to exp (should be math.exp).
  ........
    r5823 | alan.mcintyre | 2008-09-14 03:15:38 +0900 (Sun, 14 Sep 2008) | 3 lines
    
    Removed unused imports.
    Fixed undefined reference to "getpackage" (from nose.util).
  ........
    r5824 | pierregm | 2008-09-14 06:17:09 +0900 (Sun, 14 Sep 2008) | 1 line
    
    MaskedArray.__new__ : make sure that we inherit the _hardmask from data (if any) instead of reverting to default.
  ........
    r5826 | alan.mcintyre | 2008-09-18 12:29:56 +0900 (Thu, 18 Sep 2008) | 4 lines
    
    Added documentation for doctests and using the skipif and knownfailureif decorators.
    Fixed indentation on the last sample snippet in the "__init__.py and setup.py" 
    section.
  ........
    r5827 | alan.mcintyre | 2008-09-18 12:33:15 +0900 (Thu, 18 Sep 2008) | 3 lines
    
    Rewrapped __all__ to conform with PEP8.
    Removed unused imports.
  ........
    r5828 | alan.mcintyre | 2008-09-18 12:33:58 +0900 (Thu, 18 Sep 2008) | 2 lines
    
    Removed unused imports.
  ........
    r5829 | alan.mcintyre | 2008-09-18 12:45:53 +0900 (Thu, 18 Sep 2008) | 3 lines
    
    Removed unused/redundant imports.
    PEP8 conformance (only one import per line).
  ........
    r5830 | alan.mcintyre | 2008-09-18 12:57:47 +0900 (Thu, 18 Sep 2008) | 2 lines
    
    Removed redundant import.
  ........
    r5831 | pierregm | 2008-09-19 02:51:55 +0900 (Fri, 19 Sep 2008) | 1 line
    
    median : fixed a bug in _median1D (there shouldn't have been an axis)
  ........
    r5832 | jarrod.millman | 2008-09-19 03:53:53 +0900 (Fri, 19 Sep 2008) | 2 lines
    
    ReSTified an URL
  ........
    r5833 | rkern | 2008-09-19 06:48:57 +0900 (Fri, 19 Sep 2008) | 1 line
    
    BUG: Override setuptools' install.run() method to correctly allow 'python setup.py install' to work.
  ........
    r5834 | pierregm | 2008-09-19 12:33:40 +0900 (Fri, 19 Sep 2008) | 1 line
    
    * fixing view to recognize dtype and type parameters, for consistency with regular ndarrays.
  ........
    r5835 | pierregm | 2008-09-20 04:43:05 +0900 (Sat, 20 Sep 2008) | 8 lines
    
    core:
    * add dtype to the repr of masked arrays w/ flexible type
    * prevent __getitem__ to return masked on flexible-type masked array
    * make sure __str__ returns something sensible for flexible dtype w/ masked fields
    * simplify the count method
    
    mrecords:
    * fixed a pb with fromrecords when the number of fields cannot be determined from the first element.
  ........
................
  r5845 | cdavid | 2008-09-21 00:58:44 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Remove redundant definition of isnan and co in ufuncobject.h
................
  r5846 | cdavid | 2008-09-21 01:00:09 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Use a single macro for isnan replacement.
................
  r5847 | cdavid | 2008-09-21 01:01:22 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Use a single macro for isinf replacement.
................
  r5848 | cdavid | 2008-09-21 01:10:53 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Move isfinite macro with isinf and isnan.
................
  r5849 | cdavid | 2008-09-21 01:11:51 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Fix isfinite.
................
  r5850 | cdavid | 2008-09-21 01:12:59 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Autoconf suggestion is totally bogus: isinf(nan) is false, not true.
................
  r5851 | cdavid | 2008-09-21 01:13:48 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Define isfinite first, and define isinf in function of isfinite/isnan.
................
  r5852 | cdavid | 2008-09-21 01:26:30 +0900 (Sun, 21 Sep 2008) | 6 lines
  
  Fix for isfinite on VS 2003.
  
  VS 2003 seems to think it is ok to simplify x-x to 0 for float, but this is
  wrong for NaN and Inf. To  alleviate, we force the operation to occur with (x)
  + (-x).
................
  r5853 | cdavid | 2008-09-21 01:56:08 +0900 (Sun, 21 Sep 2008) | 1 line
  
  More intrinsics.
................
  r5855 | cdavid | 2008-09-21 20:39:08 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Handle msvc intrisincs in check_func.
................
  r5856 | cdavid | 2008-09-21 20:39:27 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Handle msvc intrisincs in check_funcs_once.
................
  r5857 | cdavid | 2008-09-21 20:50:32 +0900 (Sun, 21 Sep 2008) | 1 line
  
  define -> pragma, stupid mistake.
................
  r5858 | cdavid | 2008-09-21 20:54:48 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Do not use MSVC workaround anymore, since we now can test for function even when they are intrinsincs.
................
  r5861 | cdavid | 2008-09-23 12:48:01 +0900 (Tue, 23 Sep 2008) | 9 lines
  
  Merged revisions 5844-5860 via svnmerge from 
  http://svn.scipy.org/svn/numpy/trunk
  
  ........
    r5860 | stefan | 2008-09-23 05:28:00 +0900 (Tue, 23 Sep 2008) | 2 lines
    
    Ignore unused converters in `loadtxt`.
  ........
................
  r5874 | charris | 2008-09-29 08:35:15 +0900 (Mon, 29 Sep 2008) | 4 lines
  
  Enhance code_generator to allow continuation lines.
  Small clarification in arraytypes.inc.src.
  Practice merging ;)
................
  r5882 | cdavid | 2008-09-30 13:40:13 +0900 (Tue, 30 Sep 2008) | 27 lines
  
  Merged revisions 5861-5881 via svnmerge from 
  http://svn.scipy.org/svn/numpy/trunk
  
  ........
    r5862 | ptvirtan | 2008-09-24 20:50:38 +0900 (Wed, 24 Sep 2008) | 1 line
    
    Fix python2.5 dependency in lookfor
  ........
    r5869 | pierregm | 2008-09-29 02:27:37 +0900 (Mon, 29 Sep 2008) | 3 lines
    
    core:
    * added __rmul and __radd__
    * fixed concatenate for flexible-dtype
  ........
    r5878 | ptvirtan | 2008-09-30 02:23:43 +0900 (Tue, 30 Sep 2008) | 1 line
    
    Umath tests: remove signed zero check on branch cut for log* as it fails on some platforms.
  ........
    r5879 | pierregm | 2008-09-30 05:24:29 +0900 (Tue, 30 Sep 2008) | 1 line
    
    use if ...: raise AssertionError instead of assert
  ........
    r5880 | pierregm | 2008-09-30 05:24:56 +0900 (Tue, 30 Sep 2008) | 1 line
    
    replaced assert with self.failUnless
  ........
................
  r5898 | cdavid | 2008-10-03 16:21:00 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Start updating numscons configuration for new math config.
................
  r5899 | cdavid | 2008-10-03 16:21:15 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Add an help function to check a list of functions in scons build.
................
  r5900 | cdavid | 2008-10-03 16:21:31 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Fix typo in check_funcs.
................
  r5901 | cdavid | 2008-10-03 16:21:46 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Check for some optional, C99 double math functions.
................
  r5902 | cdavid | 2008-10-03 16:22:02 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Check for float/long double C99 functions.
................
  r5903 | cdavid | 2008-10-03 16:22:18 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Add check for C99 macros related IEEE-754.
................
  r5904 | cdavid | 2008-10-03 16:22:34 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Remove old configuration checks, supersded by new math config.
................
  r5905 | cdavid | 2008-10-03 16:22:57 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Generate math_c99.inc in numscons build.
................
  r5912 | cdavid | 2008-10-05 16:00:33 +0900 (Sun, 05 Oct 2008) | 39 lines
  
  Merged revisions 5882-5911 via svnmerge from 
  http://svn.scipy.org/svn/numpy/trunk
  
  ........
    r5886 | charris | 2008-10-02 03:05:29 +0900 (Thu, 02 Oct 2008) | 4 lines
    
    Make some error messages more informative.
    Improve error handling.
    Make continuation lines work.
  ........
    r5887 | charris | 2008-10-02 03:06:04 +0900 (Thu, 02 Oct 2008) | 2 lines
    
    Small cleanup to clarify repeated string.
  ........
    r5888 | charris | 2008-10-02 03:08:41 +0900 (Thu, 02 Oct 2008) | 6 lines
    
    Cleanup ufunc loops.
    At this point loops are separated into variable kinds, so there is a fair amount
    of duplication. I will probably merge loops that look the same in a later
    commit. There are no changes to current behavior of loops, this will also be
    changed in later work to deal with nans and such.
  ........
    r5889 | oliphant | 2008-10-03 05:27:17 +0900 (Fri, 03 Oct 2008) | 1 line
    
    Fix problem with subclasses of object arrays.
  ........
    r5896 | cdavid | 2008-10-03 15:50:32 +0900 (Fri, 03 Oct 2008) | 1 line
    
    Update the minimum version for numscons: had to change to cope with Chuck changes to conv_template.py.
  ........
    r5897 | cdavid | 2008-10-03 15:51:03 +0900 (Fri, 03 Oct 2008) | 1 line
    
    Update doall script: take the python version to build binaries from the command line instead of global variable.
  ........
    r5906 | oliphant | 2008-10-04 00:55:52 +0900 (Sat, 04 Oct 2008) | 1 line
    
    Fix ticket #925
  ........
................



Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/clean_math_config:1-5736 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871
   + /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/clean_math_config:1-5912 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871

Modified: trunk/numpy/core/SConscript
===================================================================
--- trunk/numpy/core/SConscript	2008-10-05 07:00:33 UTC (rev 5912)
+++ trunk/numpy/core/SConscript	2008-10-05 08:28:42 UTC (rev 5913)
@@ -1,4 +1,4 @@
-# Last Change: Tue Aug 05 12:00 PM 2008 J
+# Last Change: Fri Oct 03 04:00 PM 2008 J
 # vim:syntax=python
 import os
 import sys
@@ -136,39 +136,56 @@
 # Set value to 1 for each defined function (in math lib)
 mfuncs_defined = dict([(f, 0) for f in mfuncs])
 
-# TODO: checklib vs checkfunc ?
-def check_func(f):
-    """Check that f is available in mlib, and add the symbol appropriately.  """
-    st = config.CheckDeclaration(f, language = 'C', includes = "#include <math.h>")
-    if st:
-        st = config.CheckFunc(f, language = 'C')
-    if st:
-        mfuncs_defined[f] = 1
-    else:
-        mfuncs_defined[f] = 0
+# Check for mandatory funcs: we barf if a single one of those is not there
+mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
+"floor", "ceil", "sqrt", "log10", "log", "exp", "asin", "acos", "atan", "fmod",
+'modf', 'frexp', 'ldexp']
 
-for f in mfuncs:
-    check_func(f)
+if not config.CheckFuncsAtOnce(mandatory_funcs):
+    raise SystemError("One of the required function to build numpy is not"
+            " available (the list is %s)." % str(mandatory_funcs))
 
-if mfuncs_defined['expl'] == 1:
-    config.Define('HAVE_LONGDOUBLE_FUNCS',
-                  comment = 'Define to 1 if long double funcs are available')
-if mfuncs_defined['expf'] == 1:
-    config.Define('HAVE_FLOAT_FUNCS',
-                  comment = 'Define to 1 if long double funcs are available')
-if mfuncs_defined['asinh'] == 1:
-    config.Define('HAVE_INVERSE_HYPERBOLIC',
-                  comment = 'Define to 1 if inverse hyperbolic funcs are '\
-                            'available')
-if mfuncs_defined['atanhf'] == 1:
-    config.Define('HAVE_INVERSE_HYPERBOLIC_FLOAT',
-                  comment = 'Define to 1 if inverse hyperbolic float funcs '\
-                            'are available')
-if mfuncs_defined['atanhl'] == 1:
-    config.Define('HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE',
-                  comment = 'Define to 1 if inverse hyperbolic long double '\
-                            'funcs are available')
+# Standard functions which may not be available and for which we have a
+# replacement implementation
+#
+def check_funcs(funcs):
+    # Use check_funcs_once first, and if it does not work, test func per
+    # func. Return success only if all the functions are available
+    st = config.CheckFuncsAtOnce(funcs)
+    if not st:
+        # Global check failed, check func per func
+        for f in funcs:
+            st = config.CheckFunc(f, language = 'C')
 
+# XXX: we do not test for hypot because python checks for it (HAVE_HYPOT in
+# python.h... I wish they would clean their public headers someday)
+optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh",
+                     "rint", "trunc"]
+
+check_funcs(optional_stdfuncs)
+
+# C99 functions: float and long double versions
+c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor",
+             "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp",
+             "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh",
+             "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp']
+
+for prec in ['l', 'f']:
+    fns = [f + prec for f in c99_funcs]
+    check_funcs(fns)
+
+# Normally, isnan and isinf are macro (C99), but some platforms only have
+# func, or both func and macro version. Check for macro only, and define
+# replacement ones if not found.
+# Note: including Python.h is necessary because it modifies some math.h
+# definitions
+for f in ["isnan", "isinf", "signbit", "isfinite"]:
+    includes = """\
+#include <Python.h>
+#include <math.h>
+"""
+    config.CheckDeclaration(f, includes=includes)
+
 #-------------------------------------------------------
 # Define the function PyOS_ascii_strod if not available
 #-------------------------------------------------------
@@ -234,6 +251,7 @@
 # Generate generated code
 #------------------------
 scalartypes_src = env.GenerateFromTemplate(pjoin('src', 'scalartypes.inc.src'))
+math_c99_src = env.GenerateFromTemplate(pjoin('src', 'math_c99.inc.src'))
 arraytypes_src = env.GenerateFromTemplate(pjoin('src', 'arraytypes.inc.src'))
 sortmodule_src = env.GenerateFromTemplate(pjoin('src', '_sortmodule.c.src'))
 umathmodule_src = env.GenerateFromTemplate(pjoin('src', 'umathmodule.c.src'))

Modified: trunk/numpy/core/include/numpy/ufuncobject.h
===================================================================
--- trunk/numpy/core/include/numpy/ufuncobject.h	2008-10-05 07:00:33 UTC (rev 5912)
+++ trunk/numpy/core/include/numpy/ufuncobject.h	2008-10-05 08:28:42 UTC (rev 5913)
@@ -263,11 +263,6 @@
 		| ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);	\
 	}
 
-#define isnan(x) (_isnan((double)(x)))
-#define isinf(x) ((_fpclass((double)(x)) == _FPCLASS_PINF) ||	\
-		  (_fpclass((double)(x)) == _FPCLASS_NINF))
-#define isfinite(x) (_finite((double) x))
-
 /* Solaris --------------------------------------------------------*/
 /* --------ignoring SunOS ieee_flags approach, someone else can
 **         deal with that! */

Modified: trunk/numpy/core/setup.py
===================================================================
--- trunk/numpy/core/setup.py	2008-10-05 07:00:33 UTC (rev 5912)
+++ trunk/numpy/core/setup.py	2008-10-05 08:28:42 UTC (rev 5913)
@@ -5,20 +5,6 @@
 from numpy.distutils import log
 from distutils.dep_util import newer
 
-FUNCTIONS_TO_CHECK = [
-    ('expl', 'HAVE_LONGDOUBLE_FUNCS'),
-    ('expf', 'HAVE_FLOAT_FUNCS'),
-    ('log1p', 'HAVE_LOG1P'),
-    ('expm1', 'HAVE_EXPM1'),
-    ('asinh', 'HAVE_INVERSE_HYPERBOLIC'),
-    ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'),
-    ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'),
-    ('isnan', 'HAVE_ISNAN'),
-    ('isinf', 'HAVE_ISINF'),
-    ('rint', 'HAVE_RINT'),
-    ('trunc', 'HAVE_TRUNC'),
-    ]
-
 def is_npy_no_signal():
     """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration
     header."""
@@ -49,6 +35,75 @@
             nosmp = 0
     return nosmp == 1
 
+def check_math_capabilities(config, moredefs, mathlibs):
+    def check_func(func_name):
+        return config.check_func(func_name, libraries=mathlibs,
+                                 decl=True, call=True)
+
+    def check_funcs_once(funcs_name):
+        decl = dict([(f, True) for f in funcs_name])
+        st = config.check_funcs_once(funcs_name, libraries=mathlibs,
+                                     decl=decl, call=decl)
+        if st:
+            moredefs.extend([name_to_defsymb(f) for f in funcs_name])
+        return st
+
+    def check_funcs(funcs_name):
+        # Use check_funcs_once first, and if it does not work, test func per
+        # func. Return success only if all the functions are available
+        if not check_funcs_once(funcs_name):
+            # Global check failed, check func per func
+            for f in funcs_name:
+                if check_func(f):
+                    moredefs.append(name_to_defsymb(f))
+            return 0
+        else:
+            return 1
+
+    def name_to_defsymb(name):
+        return "HAVE_%s" % name.upper()
+
+    #use_msvc = config.check_decl("_MSC_VER")
+
+    # Mandatory functions: if not found, fail the build
+    mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
+		"floor", "ceil", "sqrt", "log10", "log", "exp", "asin",
+		"acos", "atan", "fmod", 'modf', 'frexp', 'ldexp']
+
+    if not check_funcs_once(mandatory_funcs):
+        raise SystemError("One of the required function to build numpy is not"
+                " available (the list is %s)." % str(mandatory_funcs))
+
+    # Standard functions which may not be available and for which we have a
+    # replacement implementation
+    # XXX: we do not test for hypot because python checks for it (HAVE_HYPOT in
+    # python.h... I wish they would clean their public headers someday)
+    optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh",
+                         "rint", "trunc"]
+
+    check_funcs(optional_stdfuncs)
+
+    # C99 functions: float and long double versions
+    c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor",
+                 "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp",
+                 "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh",
+                 "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp']
+
+    for prec in ['l', 'f']:
+        fns = [f + prec for f in c99_funcs]
+        check_funcs(fns)
+
+    # Normally, isnan and isinf are macro (C99), but some platforms only have
+    # func, or both func and macro version. Check for macro only, and define
+    # replacement ones if not found.
+    # Note: including Python.h is necessary because it modifies some math.h
+    # definitions
+    for f in ["isnan", "isinf", "signbit", "isfinite"]:
+        st = config.check_decl(f, headers = ["Python.h", "math.h"])
+        if st:
+            moredefs.append(name_to_defsymb("decl_%s" % f))
+
+
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration,dot_join
     from numpy.distutils.system_info import get_info, default_lib_dirs
@@ -106,15 +161,8 @@
             ext.libraries.extend(mathlibs)
             moredefs.append(('MATHLIB',','.join(mathlibs)))
 
-            def check_func(func_name):
-                return config_cmd.check_func(func_name,
-                                             libraries=mathlibs, decl=False,
-                                             headers=['math.h'])
+            check_math_capabilities(config_cmd, moredefs, mathlibs)
 
-            for func_name, defsymbol in FUNCTIONS_TO_CHECK:
-                if check_func(func_name):
-                    moredefs.append(defsymbol)
-
             if is_npy_no_signal():
                 moredefs.append('__NPY_PRIVATE_NO_SIGNAL')
 
@@ -136,6 +184,17 @@
                     target_f.write('#define %s\n' % (d))
                 else:
                     target_f.write('#define %s %s\n' % (d[0],d[1]))
+
+            # Keep those for backward compatibility for now
+            target_f.write("""
+#ifdef HAVE_EXPL
+#define HAVE_LONGDOUBLE_FUNCS
+#endif
+
+#ifdef HAVE_EXPF
+#define HAVE_FLOAT_FUNCS
+#endif
+""")
             target_f.close()
             print 'File:',target
             target_f = open(target)
@@ -264,7 +323,6 @@
             join('src','scalartypes.inc.src'),
             join('src','arraytypes.inc.src'),
             join('src','_signbit.c'),
-            join('src','_isnan.c'),
             join('src','ucsnarrow.c'),
             join('include','numpy','*object.h'),
             'include/numpy/fenv/fenv.c',
@@ -298,6 +356,7 @@
                                     generate_ufunc_api,
                                     join('src','scalartypes.inc.src'),
                                     join('src','arraytypes.inc.src'),
+                                    join('src','math_c99.inc.src'),
                                     ],
                          depends = [join('src','ufuncobject.c'),
                                     generate_umath_py,

Deleted: trunk/numpy/core/src/_isnan.c
===================================================================
--- trunk/numpy/core/src/_isnan.c	2008-10-05 07:00:33 UTC (rev 5912)
+++ trunk/numpy/core/src/_isnan.c	2008-10-05 08:28:42 UTC (rev 5913)
@@ -1,46 +0,0 @@
-/* Adapted from cephes */
-
-static int
-isnan(double x)
-{
-    union
-    {
-        double d;
-        unsigned short s[4];
-        unsigned int i[2];
-    } u;
-
-    u.d = x;
-
-#if SIZEOF_INT == 4
-
-#ifdef WORDS_BIGENDIAN /* defined in pyconfig.h */
-    if( ((u.i[0] & 0x7ff00000) == 0x7ff00000)
-        && (((u.i[0] & 0x000fffff) != 0) || (u.i[1] != 0)))
-        return 1;
-#else
-    if( ((u.i[1] & 0x7ff00000) == 0x7ff00000)
-        && (((u.i[1] & 0x000fffff) != 0) || (u.i[0] != 0)))
-        return 1;
-#endif
-
-#else  /* SIZEOF_INT != 4 */
-
-#ifdef WORDS_BIGENDIAN
-    if( (u.s[0] & 0x7ff0) == 0x7ff0)
-        {
-            if( ((u.s[0] & 0x000f) | u.s[1] | u.s[2] | u.s[3]) != 0 )
-                return 1;
-        }
-#else
-    if( (u.s[3] & 0x7ff0) == 0x7ff0) 
-        {
-            if( ((u.s[3] & 0x000f) | u.s[2] | u.s[1] | u.s[0]) != 0 )
-                return 1;
-        }
-#endif
-
-#endif  /* SIZEOF_INT */
-
-    return 0;
-}

Modified: trunk/numpy/core/src/_signbit.c
===================================================================
--- trunk/numpy/core/src/_signbit.c	2008-10-05 07:00:33 UTC (rev 5912)
+++ trunk/numpy/core/src/_signbit.c	2008-10-05 08:28:42 UTC (rev 5913)
@@ -1,7 +1,7 @@
 /* Adapted from cephes */
 
 static int
-signbit(double x)
+signbit_d(double x)
 {
     union
     {

Copied: trunk/numpy/core/src/math_c99.inc.src (from rev 5912, branches/clean_math_config/numpy/core/src/math_c99.inc.src)

Modified: trunk/numpy/core/src/umathmodule.c.src
===================================================================
--- trunk/numpy/core/src/umathmodule.c.src	2008-10-05 07:00:33 UTC (rev 5912)
+++ trunk/numpy/core/src/umathmodule.c.src	2008-10-05 08:28:42 UTC (rev 5913)
@@ -21,11 +21,7 @@
 #define M_PI 3.14159265358979323846264338328
 #endif
 
-/*
- *****************************************************************************
- **                     BASIC MATH FUNCTIONS                                **
- *****************************************************************************
- */
+#include "math_c99.inc"
 
 float degreesf(float x) {
     return x * (float)(180.0/M_PI);
@@ -47,591 +43,7 @@
     return x * (M_PI/180.0L);
 }
 
-/* 
- * A whole slew of basic math functions are provided originally
- * by Konrad Hinsen.
- */
-
-#if !defined(__STDC__) && !defined(_MSC_VER)
-extern double fmod (double, double);
-extern double frexp (double, int *);
-extern double ldexp (double, int);
-extern double modf (double, double *);
-#endif
-
-
-#if defined(DISTUTILS_USE_SDK)
-/* win32 on AMD64 build architecture */
-/* See also http://projects.scipy.org/scipy/numpy/ticket/164 */
-#ifndef HAVE_FABSF
-#ifdef fabsf
-#undef fabsf
-#endif
-static float fabsf(float x)
-{
-    return (float)fabs((double)(x));
-}
-#endif
-#ifndef HAVE_HYPOTF
-static float hypotf(float x, float y)
-{
-    return (float)hypot((double)(x), (double)(y));
-}
-#endif
-#ifndef HAVE_RINTF
-#ifndef HAVE_RINT
-static double rint (double x);
-#endif
-static float rintf(float x)
-{
-    return (float)rint((double)(x));
-}
-#endif
-#ifndef HAVE_FREXPF
-static float frexpf(float x, int * i)
-{
-    return (float)frexp((double)(x), i);
-}
-#endif
-#ifndef HAVE_LDEXPF
-static float ldexpf(float x, int i)
-{
-    return (float)ldexp((double)(x), i);
-}
-#endif
-#define tanhf nc_tanhf
-#endif
-
-#ifndef HAVE_INVERSE_HYPERBOLIC
-static double acosh(double x)
-{
-    return 2*log(sqrt((x+1.0)/2)+sqrt((x-1.0)/2));
-}
-
-double log1p(double);
-static double asinh(double xx)
-{
-    double x, d;
-    int sign;
-    if (xx < 0.0) {
-        sign = -1;
-        x = -xx;
-    }
-    else {
-        sign = 1;
-        x = xx;
-    }
-    if (x > 1e8) {
-        d = x;
-    } else {
-        d = sqrt(x*x + 1);
-    }
-    return sign*log1p(x*(1.0 + x/(d+1)));
-}
-
-static double atanh(double x)
-{
-    return 0.5*log1p(2.0*x/(1.0-x));
-}
-#endif
-
-#if !defined(HAVE_INVERSE_HYPERBOLIC_FLOAT)
-#ifdef HAVE_FLOAT_FUNCS
-#ifdef log1pf
-#undef log1pf
-#endif
-#ifdef logf
-#undef logf
-#endif
-#ifdef sqrtf
-#undef sqrtf
-#endif
-float log1pf(float);
-#ifdef DISTUTILS_USE_SDK
-DL_IMPORT(float) logf(float);
-DL_IMPORT(float) sqrtf(float);
-#else
-/* should these be extern?: */
-float logf(float);
-float sqrtf(float);
-#endif
-#ifdef acoshf
-#undef acoshf
-#endif
-static float acoshf(float x)
-{
-    return 2*logf(sqrtf((x+1)/2)+sqrtf((x-1)/2));
-}
-
-#ifdef asinhf
-#undef asinhf
-#endif
-static float asinhf(float xx)
-{
-    float x, d;
-    int sign;
-    if (xx < 0) {
-        sign = -1;
-        x = -xx;
-    }
-    else {
-        sign = 1;
-        x = xx;
-    }
-    if (x > 1e5) {
-        d = x;
-    } else {
-        d = sqrtf(x*x + 1);
-    }
-    return sign*log1pf(x*(1 + x/(d+1)));
-}
-
-#ifdef atanhf
-#undef atanhf
-#endif
-static float atanhf(float x)
-{
-    return log1pf(2*x/(1-x))/2;
-}
-#else
-#ifdef acoshf
-#undef acoshf
-#endif
-static float acoshf(float x)
-{
-    return (float)acosh((double)(x));
-}
-
-#ifdef asinhf
-#undef asinhf
-#endif
-static float asinhf(float x)
-{
-    return (float)asinh((double)(x));
-}
-
-#ifdef atanhf
-#undef atanhf
-#endif
-static float atanhf(float x)
-{
-    return (float)atanh((double)(x));
-}
-#endif
-#endif
-
-
-#if !defined(HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE)
-#ifdef HAVE_LONGDOUBLE_FUNCS
-#ifdef logl
-#undef logl
-#endif
-#ifdef sqrtl
-#undef sqrtl
-#endif
-#ifdef log1pl
-#undef log1pl
-#endif
-longdouble logl(longdouble);
-longdouble sqrtl(longdouble);
-longdouble log1pl(longdouble);
-#ifdef acoshl
-#undef acoshl
-#endif
-static longdouble acoshl(longdouble x)
-{
-    return 2*logl(sqrtl((x+1.0)/2)+sqrtl((x-1.0)/2));
-}
-
-#ifdef asinhl
-#undef asinhl
-#endif
-static longdouble asinhl(longdouble xx)
-{
-    longdouble x, d;
-    int sign;
-    if (xx < 0.0) {
-        sign = -1;
-        x = -xx;
-    }
-    else {
-        sign = 1;
-        x = xx;
-    }
-    if (x > 1e17) {
-        d = x;
-    } else {
-        d = sqrtl(x*x + 1);
-    }
-    return sign*log1pl(x*(1.0 + x/(d+1)));
-}
-
-#ifdef atanhl
-#undef atanhl
-#endif
-static longdouble atanhl(longdouble x)
-{
-    return 0.5*log1pl(2.0*x/(1.0-x));
-}
-
-#else
-
-#ifdef acoshl
-#undef acoshl
-#endif
-static longdouble acoshl(longdouble x)
-{
-    return (longdouble)acosh((double)(x));
-}
-
-#ifdef asinhl
-#undef asinhl
-#endif
-static longdouble asinhl(longdouble x)
-{
-    return (longdouble)asinh((double)(x));
-}
-
-#ifdef atanhl
-#undef atanhl
-#endif
-static longdouble atanhl(longdouble x)
-{
-    return (longdouble)atanh((double)(x));
-}
-
-#endif
-#endif
-
-
-#ifdef HAVE_HYPOT
-#if !defined(NeXT) && !defined(_MSC_VER)
-extern double hypot(double, double);
-#endif
-#else
-static double hypot(double x, double y)
-{
-    double yx;
-
-    x = fabs(x);
-    y = fabs(y);
-    if (x < y) {
-        double temp = x;
-        x = y;
-        y = temp;
-    }
-    if (x == 0.)
-        return 0.;
-    else {
-        yx = y/x;
-        return x*sqrt(1.+yx*yx);
-    }
-}
-#endif
-
-#ifndef HAVE_RINT
-/* needs cleanup */
-static double
-rint(double x)
-{
-    double y, r;
-
-    y = floor(x);
-    r = x - y;
-
-    if (r > 0.5) goto rndup;
-
-    /* Round to nearest even */
-    if (r==0.5) {
-        r = y - 2.0*floor(0.5*y);
-        if (r==1.0) {
-        rndup:
-            y+=1.0;
-        }
-    }
-    return y;
-}
-#endif
-
 /*
- * Comment out trunc definition until build problems are fixed.
- */
-/*
-#ifndef HAVE_TRUNC
-static double
-trunc(double x)
-{
-    if (x < 0) {
-    	return ceil(x);
-    }
-    else {
-        return floor(x);
-    }
-
-}
-#endif
-*/
-
-
-
-
-/* Define isnan, isinf, isfinite, signbit if needed */
-/* Use fpclassify if possible */
-/* isnan, isinf --
-   these will use macros and then fpclassify if available before
-   defaulting to a dumb convert-to-double version...
-
-   isfinite -- define a macro if not already available
-   signbit -- if macro available use it, otherwise define a function
-   and a dumb convert-to-double version for other types.
-*/
-
-#if defined(fpclassify)
-
-#if !defined(isnan)
-#define isnan(x) (fpclassify(x) == FP_NAN)
-#endif
-#if !defined(isinf)
-#define isinf(x) (fpclassify(x) == FP_INFINITE)
-#endif
-
-#else  /* check to see if already have a function like this */
-
-#if !defined(HAVE_ISNAN)
-
-#if !defined(isnan)
-#include "_isnan.c"
-#endif
-#endif /* HAVE_ISNAN */
-
-#if !defined(HAVE_ISINF)
-#if !defined(isinf)
-#define isinf(x) (!isnan((x)) && isnan((x)-(x)))
-#endif
-#endif /* HAVE_ISINF */
-
-#endif /* defined(fpclassify) */
-
-
-/* Define signbit if needed */
-#if !defined(signbit)
-#include "_signbit.c"
-#endif
-
-/* Now defined the extended type macros */
-
-#if !defined(isnan)
-
-#if !defined(HAVE_LONGDOUBLE_FUNCS) || !defined(HAVE_ISNAN)
-#define isnanl(x) isnan((double)(x))
-#endif
-
-#if !defined(HAVE_FLOAT_FUNCS) || !defined(HAVE_ISNAN)
-#define isnanf(x) isnan((double)(x))
-#endif
-
-#else /* !defined(isnan) */
-
-#define isnanl(x) isnan((x))
-#define isnanf(x) isnan((x))
-
-#endif /* !defined(isnan) */
-
-
-#if !defined(isinf)
-
-#if !defined(HAVE_LONGDOUBLE_FUNCS) || !defined(HAVE_ISINF)
-#define isinfl(x) (!isnanl((x)) && isnanl((x)-(x)))
-#endif
-
-#if !defined(HAVE_FLOAT_FUNCS) || !defined(HAVE_ISINF)
-#define isinff(x) (!isnanf((x)) && isnanf((x)-(x)))
-#endif
-
-#else /* !defined(isinf) */
-
-#define isinfl(x) isinf((x))
-#define isinff(x) isinf((x))
-
-#endif /* !defined(isinf) */
-
-
-#if !defined(signbit)
-#define signbitl(x) ((longdouble) signbit((double)(x)))
-#define signbitf(x) ((float) signbit((double) (x)))
-#else
-#define signbitl(x) signbit((x))
-#define signbitf(x) signbit((x))
-#endif
-
-#if !defined(isfinite)
-#define isfinite(x) (!(isinf((x)) || isnan((x))))
-#endif
-#define isfinitef(x) (!(isinff((x)) || isnanf((x))))
-#define isfinitel(x) (!(isinfl((x)) || isnanl((x))))
-
-/* First, the C functions that do the real work */
-
-/* if C99 extensions not available then define dummy functions that use the
-   double versions for
-
-   sin, cos, tan
-   sinh, cosh, tanh,
-   fabs, floor, ceil, fmod, sqrt, log10, log, exp, fabs
-   asin, acos, atan,
-   asinh, acosh, atanh
-
-   hypot, atan2, pow
-*/
-
-/**begin repeat
-
-   #kind=(sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,sqrt,log10,log,exp,asin,acos,atan,rint)*2#
-   #typ=longdouble*17, float*17#
-   #c=l*17,f*17#
-   #TYPE=LONGDOUBLE*17, FLOAT*17#
-*/
-
-#ifndef HAVE_@TYPE@_FUNCS
-#ifdef @kind@@c@
-#undef @kind@@c@
-#endif
-@typ@ @kind@@c@(@typ@ x) {
-    return (@typ@) @kind@((double)x);
-}
-#endif
-/**end repeat**/
-
-/**begin repeat
-
-   #kind=(atan2,hypot,pow,fmod)*2#
-   #typ=longdouble*4, float*4#
-   #c=l*4,f*4#
-   #TYPE=LONGDOUBLE*4,FLOAT*4#
-*/
-#ifndef HAVE_@TYPE@_FUNCS
-#ifdef @kind@@c@
-#undef @kind@@c@
-#endif
-@typ@ @kind@@c@(@typ@ x, @typ@ y) {
-    return (@typ@) @kind@((double)x, (double) y);
-}
-#endif
-/**end repeat**/
-
-/**begin repeat
-   #kind=modf*2#
-   #typ=longdouble, float#
-   #c=l,f#
-   #TYPE=LONGDOUBLE, FLOAT#
-*/
-#ifndef HAVE_@TYPE@_FUNCS
-#ifdef modf@c@
-#undef modf@c@
-#endif
-@typ@ modf@c@(@typ@ x, @typ@ *iptr) {
-    double nx, niptr, y;
-    nx = (double) x;
-    y = modf(nx, &niptr);
-    *iptr = (@typ@) niptr;
-    return (@typ@) y;
-}
-#endif
-/**end repeat**/
-
-
-
-#ifndef HAVE_LOG1P
-double log1p(double x)
-{
-    double u = 1. + x;
-    if (u == 1.0) {
-        return x;
-    } else {
-        return log(u) * x / (u-1.);
-    }
-}
-#endif
-
-#if !defined(HAVE_LOG1P) || !defined(HAVE_LONGDOUBLE_FUNCS)
-#ifdef log1pl
-#undef log1pl
-#endif
-longdouble log1pl(longdouble x)
-{
-    longdouble u = 1. + x;
-    if (u == 1.0) {
-        return x;
-    } else {
-        return logl(u) * x / (u-1.);
-    }
-}
-#endif
-
-#if !defined(HAVE_LOG1P) || !defined(HAVE_FLOAT_FUNCS)
-#ifdef log1pf
-#undef log1pf
-#endif
-float log1pf(float x)
-{
-    float u = 1 + x;
-    if (u == 1) {
-        return x;
-    } else {
-        return logf(u) * x / (u-1);
-    }
-}
-#endif
-
-#ifndef HAVE_EXPM1
-static double expm1(double x)
-{
-    double u = exp(x);
-    if (u == 1.0) {
-        return x;
-    } else if (u-1.0 == -1.0) {
-        return -1;
-    } else {
-        return (u-1.0) * x/log(u);
-    }
-}
-#endif
-
-#if !defined(HAVE_EXPM1) || !defined(HAVE_LONGDOUBLE_FUNCS)
-#ifdef expml1
-#undef expml1
-#endif
-static longdouble expm1l(longdouble x)
-{
-    longdouble u = expl(x);
-    if (u == 1.0) {
-        return x;
-    } else if (u-1.0 == -1.0) {
-        return -1;
-    } else {
-        return (u-1.0) * x/logl(u);
-    }
-}
-#endif
-
-#if !defined(HAVE_EXPM1) || !defined(HAVE_FLOAT_FUNCS)
-#ifdef expm1f
-#undef expm1f
-#endif
-static float expm1f(float x)
-{
-    float u = expf(x);
-    if (u == 1) {
-        return x;
-    } else if (u-1 == -1) {
-        return -1;
-    } else {
-        return (u-1) * x/logf(u);
-    }
-}
-#endif
-
-/*
  *****************************************************************************
  **                        PYTHON OBJECT FUNCTIONS                          **
  *****************************************************************************
@@ -1701,8 +1113,7 @@
     }
 }
 
-#define HAVE_DOUBLE_FUNCS
-#ifdef HAVE_@TYPE@_FUNCS
+#ifdef HAVE_FREXP@C@
 static void
 @TYPE@_frexp(char **args, intp *dimensions, intp *steps, void *func)
 {
@@ -1711,7 +1122,9 @@
         *(@type@ *)op1 = frexp@c@(in1, (int *)op2);
     }
 }
+#endif
 
+#ifdef HAVE_LDEXP@C@
 static void
 @TYPE@_ldexp(char **args, intp *dimensions, intp *steps, void *func)
 {
@@ -1722,7 +1135,6 @@
     }
 }
 #endif
-#undef HAVE_DOUBLE_FUNCS
 
 #define @TYPE@_true_divide @TYPE@_divide
 
@@ -2015,7 +1427,6 @@
 #define @CTYPE@_true_divide @CTYPE@_divide
 /**end repeat**/
 
-
 /*
  *****************************************************************************
  **                            OBJECT LOOPS                                 **
@@ -2036,7 +1447,6 @@
 }
 /**end repeat**/
 
-static void
 OBJECT_sign(char **args, intp *dimensions, intp *steps, void *func)
 {
     PyObject *zero = PyInt_FromLong(0);
@@ -2055,43 +1465,43 @@
 
 
 static PyUFuncGenericFunction frexp_functions[] = {
-#ifdef HAVE_FLOAT_FUNCS
+#ifdef HAVE_FREXPF
     FLOAT_frexp,
 #endif
     DOUBLE_frexp
-#ifdef HAVE_LONGDOUBLE_FUNCS
+#ifdef HAVE_FREXPL
     ,LONGDOUBLE_frexp
 #endif
 };
 
 static void * blank3_data[] = { (void *)NULL, (void *)NULL, (void *)NULL};
 static char frexp_signatures[] = {
-#ifdef HAVE_FLOAT_FUNCS
+#ifdef HAVE_FREXPF
     PyArray_FLOAT, PyArray_FLOAT, PyArray_INT,
 #endif
     PyArray_DOUBLE, PyArray_DOUBLE, PyArray_INT
-#ifdef HAVE_LONGDOUBLE_FUNCS
+#ifdef HAVE_FREXPL
     ,PyArray_LONGDOUBLE, PyArray_LONGDOUBLE, PyArray_INT
 #endif
 };
 
 
 static PyUFuncGenericFunction ldexp_functions[] = {
-#ifdef HAVE_FLOAT_FUNCS
+#ifdef HAVE_LDEXPF
     FLOAT_ldexp,
 #endif
     DOUBLE_ldexp
-#ifdef HAVE_LONGDOUBLE_FUNCS
+#ifdef HAVE_LDEXPL
     ,LONGDOUBLE_ldexp
 #endif
 };
 
 static char ldexp_signatures[] = {
-#ifdef HAVE_FLOAT_FUNCS
+#ifdef HAVE_LDEXPF
     PyArray_FLOAT, PyArray_INT, PyArray_FLOAT,
 #endif
     PyArray_DOUBLE, PyArray_INT, PyArray_DOUBLE
-#ifdef HAVE_LONGDOUBLE_FUNCS
+#ifdef HAVE_LDEXPL
     ,PyArray_LONGDOUBLE, PyArray_INT, PyArray_LONGDOUBLE
 #endif
 };
@@ -2140,10 +1550,10 @@
     PyObject *f;
     int num=1;
 
-#ifdef HAVE_LONGDOUBLE_FUNCS
+#ifdef HAVE_FREXPL
     num += 1;
 #endif
-#ifdef HAVE_FLOAT_FUNCS
+#ifdef HAVE_FREXPF
     num += 1;
 #endif
     f = PyUFunc_FromFuncAndData(frexp_functions, blank3_data,
@@ -2154,6 +1564,13 @@
     PyDict_SetItemString(dictionary, "frexp", f);
     Py_DECREF(f);
 
+    num = 1;
+#ifdef HAVE_LDEXPL
+    num += 1;
+#endif
+#ifdef HAVE_LDEXPF
+    num += 1;
+#endif
     f = PyUFunc_FromFuncAndData(ldexp_functions, blank3_data, ldexp_signatures, num,
                                 2, 1, PyUFunc_None, "ldexp",
                                 "Compute y = x1 * 2**x2.",0);

Modified: trunk/numpy/distutils/command/config.py
===================================================================
--- trunk/numpy/distutils/command/config.py	2008-10-05 07:00:33 UTC (rev 5912)
+++ trunk/numpy/distutils/command/config.py	2008-10-05 08:28:42 UTC (rev 5913)
@@ -126,6 +126,13 @@
         body = []
         if decl:
             body.append("int %s ();" % func)
+        # Handle MSVC intrisincs: force MS compiler to make a function call.
+        # Useful to test for some functions when built with optimization on, to
+        # avoid build error because the intrisinc and our 'fake' test
+        # declaration do not match.
+        body.append("#ifdef _MSC_VER")
+        body.append("#pragma function(%s)" % func)
+        body.append("#endif")
         body.append("int main (void) {")
         if call:
             if call_args is None:
@@ -140,6 +147,67 @@
         return self.try_link(body, headers, include_dirs,
                              libraries, library_dirs)
 
+    def check_funcs_once(self, funcs,
+                   headers=None, include_dirs=None,
+                   libraries=None, library_dirs=None,
+                   decl=False, call=False, call_args=None):
+        """Check a list of functions at once.
+
+        This is useful to speed up things, since all the functions in the funcs
+        list will be put in one compilation unit.
+
+        Arguments
+        ---------
+
+            funcs: seq
+                list of functions to test
+            include_dirs : seq
+                list of header paths
+            libraries : seq
+                list of libraries to link the code snippet to
+            libraru_dirs : seq
+                list of library paths
+            decl : dict
+                for every (key, value), the declaration in the value will be
+                used for function in key. If a function is not in the
+                dictionay, no declaration will be used.
+            call : dict
+                for every item (f, value), if the value is True, a call will be
+                done to the function f"""
+        self._check_compiler()
+        body = []
+        if decl:
+            for f, v in decl.items():
+                if v:
+                    body.append("int %s ();" % f)
+
+        # Handle MS intrinsics. See check_func for more info.
+        body.append("#ifdef _MSC_VER")
+        for func in funcs:
+            body.append("#pragma function(%s)" % func)
+        body.append("#endif")
+
+        body.append("int main (void) {")
+        if call:
+            for f in funcs:
+                if call.has_key(f) and call[f]:
+                    if not (call_args and call_args.has_key(f) and call_args[f]):
+                        args = ''
+                    else:
+                        args = call_args[f]
+                    body.append("  %s(%s);" % (f, args))
+                else:
+                    body.append("  %s;" % f)
+        else:
+            for f in funcs:
+                body.append("  %s;" % f)
+        body.append("  return 0;")
+        body.append("}")
+        body = '\n'.join(body) + "\n"
+
+        return self.try_link(body, headers, include_dirs,
+                             libraries, library_dirs)
+
     def get_output(self, body, headers=None, include_dirs=None,
                    libraries=None, library_dirs=None,
                    lang="c"):



More information about the Numpy-svn mailing list