summaryrefslogtreecommitdiff
path: root/numpy/random/_examples/cython/setup.py
diff options
context:
space:
mode:
authorKevin Sheppard <kevin.k.sheppard@gmail.com>2021-03-17 10:46:14 +0000
committerKevin Sheppard <kevin.k.sheppard@gmail.com>2021-03-17 14:25:41 +0000
commit4572e12e199c2032c159121ae9afd12c3d3d5a5a (patch)
tree56cf4de3e57adb2afeb3380cbdab6c2dab12b91c /numpy/random/_examples/cython/setup.py
parent398b01f346116e7974ef9bacf0a2b29f1b3492e4 (diff)
downloadnumpy-4572e12e199c2032c159121ae9afd12c3d3d5a5a.tar.gz
BUG: Use lop1p to improve numerical precision
Use log1p(-x) instead of log(1 - x) Seperate legacy version from current closes #17020
Diffstat (limited to 'numpy/random/_examples/cython/setup.py')
-rw-r--r--numpy/random/_examples/cython/setup.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/numpy/random/_examples/cython/setup.py b/numpy/random/_examples/cython/setup.py
index 83f06fde8..7e0dd3e05 100644
--- a/numpy/random/_examples/cython/setup.py
+++ b/numpy/random/_examples/cython/setup.py
@@ -4,19 +4,20 @@ Build the Cython demonstrations of low-level access to NumPy random
Usage: python setup.py build_ext -i
"""
+from distutils.core import setup
+from os.path import dirname, join, abspath
import numpy as np
-from distutils.core import setup
from Cython.Build import cythonize
+from numpy.distutils.misc_util import get_info
from setuptools.extension import Extension
-from os.path import join, dirname
path = dirname(__file__)
src_dir = join(dirname(path), '..', 'src')
defs = [('NPY_NO_DEPRECATED_API', 0)]
inc_path = np.get_include()
-# not so nice. We need the random/lib library from numpy
-lib_path = join(np.get_include(), '..', '..', 'random', 'lib')
+lib_path = [abspath(join(np.get_include(), '..', '..', 'random', 'lib'))]
+lib_path += get_info('npymath')['library_dirs']
extending = Extension("extending",
sources=[join('.', 'extending.pyx')],
@@ -29,10 +30,10 @@ extending = Extension("extending",
distributions = Extension("extending_distributions",
sources=[join('.', 'extending_distributions.pyx')],
include_dirs=[inc_path],
- library_dirs=[lib_path],
- libraries=['npyrandom'],
+ library_dirs=lib_path,
+ libraries=['npyrandom', 'npymath'],
define_macros=defs,
- )
+ )
extensions = [extending, distributions]