a
    ³ÐOcò  ã                   @   sØ   d Z ddlZddlZddlZddlmZ ddlm	Z	 eƒ Z
ej d¡rRe
 d¡Zn ej d¡rje
 d¡Znedƒ‚e
 d¡ e	ƒ ZejZejZejZd	d
„ Zejedd�Zee
 de¡ƒZedeƒZeedd… ƒ dS )a!  
Building the required library in this example requires a source distribution
of NumPy or clone of the NumPy git repository since distributions.c is not
included in binary distributions.

On *nix, execute in numpy/random/src/distributions

export ${PYTHON_VERSION}=3.8 # Python version
export PYTHON_INCLUDE=#path to Python's include folder, usually \
    ${PYTHON_HOME}/include/python${PYTHON_VERSION}m
export NUMPY_INCLUDE=#path to numpy's include folder, usually \
    ${PYTHON_HOME}/lib/python${PYTHON_VERSION}/site-packages/numpy/core/include
gcc -shared -o libdistributions.so -fPIC distributions.c \
    -I${NUMPY_INCLUDE} -I${PYTHON_INCLUDE}
mv libdistributions.so ../../_examples/numba/

On Windows

rem PYTHON_HOME and PYTHON_VERSION are setup dependent, this is an example
set PYTHON_HOME=c:\Anaconda
set PYTHON_VERSION=38
cl.exe /LD .\distributions.c -DDLL_EXPORT \
    -I%PYTHON_HOME%\lib\site-packages\numpy\core\include \
    -I%PYTHON_HOME%\include %PYTHON_HOME%\libs\python%PYTHON_VERSION%.lib
move distributions.dll ../../_examples/numba/
é    N)ÚFFI)ÚPCG64z./distributions.dllz./libdistributions.soz#Required DLL/so file was not found.z4
double random_standard_normal(void *bitgen_state);
c                 C   s(   t  | ¡}t| ƒD ]}t|ƒ||< q|S )N)ÚnpÚemptyÚrangeÚrandom_standard_normal)ÚnÚbit_generatorÚoutÚi© r   úk/var/www/html/gsl.tools/lib/python3.9/site-packages/numpy/random/_examples/numba/extending_distributions.pyÚnormals5   s    
r   T)ZnopythonZ	uintptr_tiè  é   )Ú__doc__ÚosZnumbaÚnbÚnumpyr   Zcffir   Znumpy.randomr   ÚffiÚpathÚexistsÚdlopenÚlibÚRuntimeErrorZcdefÚxZxffir	   r   r   ZjitZnormalsjÚintÚcastZbit_generator_addressZnormÚprintr   r   r   r   Ú<module>   s*   

