B
    FŽ0dM  ã            #   @   s0  d dl Z d dlZd dlZd dlZd dlmZ dZdZG dd„ deƒZ	dd„ Z
d	d
„ Zdd„ Zdddddddddddddddddddd gZd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7gZd8d9d:d;d<d=d>gZd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOgZdPdQdRdSdTdUdVgZdWdXdYgZdZd[gZd!d"d#d%d$d*d-d/d0g	Zdddddddddd&d'dddd"dd!dddd$d#d%d*d+d,dddd d(d)d-d.d3g#Zd\d]„ eD ƒZd^d]„ eD ƒZd_d`dagZdbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwgZdxdy„ Zdzd{„ Zd|d}„ Zd~d„ Zd€Zdd‚„ Zdƒdƒdƒdƒdƒdƒdƒdƒd„d…d†d‡dˆd‰dŠd‹gZ dŒddŽddd‘d’d“gZ!d”d•d–d—d‘dƒdƒdƒgZ"e"ddd˜… Z#dƒdƒdƒdƒd™dšd›dœddždƒdƒgZ$dƒdƒdƒdƒd™dšd›dœddždƒdƒdƒdƒdƒdƒgZ%džddƒdƒdœd›dšd™dƒdƒdƒdƒgZ&džddŸd d†d¡dƒdƒdƒdƒdƒdƒdƒdƒdƒdƒgZ'e'ddd˜… Z(d”d•d–d—d‘dƒdƒdƒgdƒgd¢  Z)dƒdƒdƒd‘d—d–d•d”gdƒgd¢  Z*d£d¤„ Z+d¥d¦„ Z,dS )§é    N)Úmingw32i	  é   c               @   s   e Zd ZdS )ÚMismatchCAPIWarningN)Ú__name__Ú
__module__Ú__qualname__© r   r   úI/var/www/html/venv/lib/python3.7/site-packages/numpy/core/setup_common.pyr   0   s   r   c             C   sF   ddl m} |  d¡}|dkr&tdƒ‚||dj}t|ƒdkrBdS d	S )
z7Return True if a released version of numpy is detected.r   )ÚLooseVersionz../_version.pyNzCould not get version)Zvstringé   FT)Zdistutils.versionr
   Úget_versionÚ
ValueErrorÚversionÚlen)Úconfigr
   ÚvÚpvr   r   r	   Úis_released3   s    
r   c             C   sN   t j d|¡ z(tdƒ}tdƒ}| |j¡}| ¡ }W dt jd= X |||  fS )z°
    Return current C API checksum and the recorded checksum.

    Return current C API checksum and the recorded checksum for the given
    version of the C API version.

    r   ZgenapiÚ	numpy_apiN)ÚsysÚpathÚinsertÚ
__import__Zfullapi_hashZfull_apiZget_versions_hash)Ú
apiversionÚcodegen_dirÚmr   Úcurapi_hashZ	apis_hashr   r   r	   Úget_api_versions?   s    

r   c             C   s<   t | |ƒ\}}||ks8d}tj|| || |tf tdd dS )z@Emits a MismatchCAPIWarning if the C API version needs updating.a  API mismatch detected, the C API version numbers have to be updated. Current C api version is %d, with checksum %s, but recorded checksum for C API version %d in core/codegen_dir/cversions.txt is %s. If functions were added in the C API, you have to update C_API_VERSION in %s.é   )Ú
stacklevelN)r   ÚwarningsÚwarnÚ__file__r   )r   r   r   Zapi_hashÚmsgr   r   r	   Úcheck_api_versionT   s    r$   ÚsinÚcosÚtanÚsinhÚcoshÚtanhÚfabsÚfloorÚceilÚsqrtÚlog10ÚlogÚexpÚasinÚacosÚatanÚfmodÚmodfÚfrexpÚldexpÚexpm1Úlog1pÚacoshÚasinhÚatanhZrintÚtruncZexp2Úlog2ÚhypotÚatan2ÚpowÚcopysignZ	nextafterZftelloZfseekoZstrtollZstrtoullZcbrtZ	strtold_lZ	fallocateZ	backtraceZmadvisezxmmintrin.hzemmintrin.hzimmintrin.hz
features.hz	xlocale.hzdlfcn.hz
sys/mman.h)Z__builtin_isnanz5.)Z__builtin_isinfz5.)Z__builtin_isfinitez5.)Z__builtin_bswap32Ú5u)Z__builtin_bswap64rD   )Z__builtin_expectz5, 0)Z__builtin_mul_overflowz5, 5, (int*)5)Z_m_from_int64Ú0zemmintrin.h)Z_mm_load_psz	(float*)0zxmmintrin.h)Z_mm_prefetchz(float*)0, _MM_HINT_NTAzxmmintrin.h)Z_mm_load_pdz
(double*)0zemmintrin.h)Z__builtin_prefetchz(float*)0, 0, 3)z__asm__ volatilez"vpand %xmm1, %xmm2, %xmm3"zstdio.hZLINK_AVX)z__asm__ volatilez"vpand %ymm1, %ymm2, %ymm3"zstdio.hZ	LINK_AVX2)z__asm__ volatilez"vpaddd %zmm1, %zmm2, %zmm3"zstdio.hZLINK_AVX512F)z__asm__ volatilez²"vfpclasspd $0x40, %zmm15, %k6\n"                                             "vmovdqu8 %xmm0, %xmm1\n"                                             "vpbroadcastmb2q %k0, %xmm0\n"zstdio.hZLINK_AVX512_SKX)z__asm__ volatilez"xgetbv"zstdio.hZXGETBV)z)__attribute__((optimize("unroll-loops")))Zattribute_optimize_unroll_loops)z__attribute__((optimize("O3")))Zattribute_optimize_opt_3)z__attribute__((nonnull (1)))Zattribute_nonnull)z__attribute__((target ("avx")))Zattribute_target_avx)z __attribute__((target ("avx2")))Zattribute_target_avx2)z#__attribute__((target ("avx512f")))Zattribute_target_avx512f)zG__attribute__((target ("avx512f,avx512dq,avx512bw,avx512vl,avx512cd")))Zattribute_target_avx512_skx)z#__attribute__((target("avx2,fma")))Z%attribute_target_avx2_with_intrinsicszk__m256 temp = _mm256_set1_ps(1.0); temp =                                 _mm256_fmadd_ps(temp, temp, temp)zimmintrin.h)z"__attribute__((target("avx512f")))Z(attribute_target_avx512f_with_intrinsicsz7__m512i temp = _mm512_castps_si512(_mm512_set1_ps(1.0))zimmintrin.h)zG__attribute__((target ("avx512f,avx512dq,avx512bw,avx512vl,avx512cd")))Z+attribute_target_avx512_skx_with_intrinsicsa"  __mmask8 temp = _mm512_fpclass_pd_mask(_mm512_set1_pd(1.0), 0x01);                                __m512i unused_temp =                                     _mm512_castps_si512(_mm512_set1_ps(1.0));                                _mm_mask_storeu_epi8(NULL, 0xFF, _mm_broadcastmb_epi64(temp))zimmintrin.hZ__threadz__declspec(thread)c             C   s   g | ]}|d  ‘qS )Úfr   )Ú.0rF   r   r   r	   ú
<listcomp>Ý   s    rH   c             C   s   g | ]}|d  ‘qS )Úlr   )rG   rF   r   r   r	   rH   Þ   s    zcomplex doublezcomplex floatzcomplex long doubleZcabsZcacosZcacoshZcargZcasinZcasinhZcatanZcatanhZccosZccoshZcexpZcimagZclogZconjZcpowZcprojZcrealZcsinZcsinhZcsqrtZctanZctanhc             C   s   d|   ¡  S )NzHAVE_%s)Úupper)Únamer   r   r	   Ú	fname2defè   s    rL   c             C   s   |   dd¡}| ¡ S )Nú Ú )ÚreplacerJ   )ÚsymbolÚdefiner   r   r	   Úsym2defë   s    rR   c             C   s   |   dd¡}| ¡ S )NrM   Ú_)rO   rJ   )rP   rQ   r   r   r	   Útype2defï   s    rT   c          	   C   s@  |   ¡  tddi }tjdkrRtƒ sRy| jj d¡ W q  tt	fk
rN   Y q X nNtjdkr | jj
 d¡r d| jjkr | jj dd¡}| jj|||||d	 d
 |  |d d d¡\}}z|ytt|ƒƒ}|S  t	k
r,   | dd¡}|d7 }|  |d d d¡\}}| j d¡ | j |gd¡ ttdƒƒ}|S X W d |  ¡  X d S )NÚtypezlong doubleÚwin32z/GLÚintelz-ipoz -iporN   z -shared)ÚcompilerÚcompiler_soÚcompiler_cxxÚ
linker_exeÚ	linker_soÚcÚstructzvolatile structz)int main(void) { return foo.before[0]; }
Z_configtest)Ú_check_compilerÚLONG_DOUBLE_REPRESENTATION_SRCr   Úplatformr   rX   Zcompile_optionsÚremoveÚAttributeErrorr   Úcompiler_typeÚ
startswithZcc_exerO   Úset_executablesÚ_compileÚlong_double_representationÚpyodZ
temp_filesÚappendZlink_executableZ_clean)ÚcmdÚbodyZnewcompilerÚsrcÚobjZltyper   r   r	   Ú check_long_double_representationô   s<    

ro   aA  
/* "before" is 16 bytes to ensure there's no padding between it and "x".
 *    We're not expecting any "long double" bigger than 16 bytes or with
 *       alignment requirements stricter than 16 bytes.  */
typedef %(type)s test_type;

struct {
        char         before[16];
        test_type    x;
        char         after[8];
} foo = {
        { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
          '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
        -123456789.0,
        { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
};
c          	   C   s”   g }t | dƒ}dd„ | ¡ D ƒ}W dQ R X xbtdt|ƒdƒD ]N}dtt|ƒdd… ƒ g}| d	d„ |||d … D ƒ¡ | d
 |¡¡ q>W |S )a£  Python implementation of the od UNIX utility (od -b, more exactly).

    Parameters
    ----------
    filename : str
        name of the file to get the dump from.

    Returns
    -------
    out : seq
        list of lines of od output

    Notes
    -----
    We only implement enough to get the necessary information for long double
    representation, this is not intended as a compatible replacement for od.
    Úrbc             S   s   g | ]}t |ƒd d… ‘qS )r   N)Úoct)rG   Úor   r   r	   rH   I  s    zpyod.<locals>.<listcomp>Nr   é   z%07dr   c             S   s   g | ]}d t |ƒ ‘qS )z%03d)Úint)rG   r]   r   r   r	   rH   L  s    rM   )	ÚopenÚreadÚranger   rt   rq   Úextendrj   Újoin)ÚfilenameÚoutZfidZyo2ÚiÚliner   r   r	   ri   5  s     ri   Z000Z001Z043Z105Z147Z211Z253Z315Z357Z376Z334Z272Z230Z166Z124Z062Z020Z301Z235Z157Z064éÿÿÿÿZ240Z242Z171Z353Z031Z300Z326Z363Ú100é   c             C   s–  dgd }d}x\| D ]R}xJ|  ¡ dd… D ]4}| d¡ | |¡ |dd… tkr0t |¡}|dd… tdd… kr¦|dd… tkrd	S |dd… tkr¤d
S q0|dd… tdd… kr,|dd… tkrÔdS |dd… t	krèdS |dd… t
k rþdS |dd… tkrdS |dd… tkrfdS q0|dd… tkr0|dd… tkrRdS |dd… tkr0dS q0W qW |dk	r†td| ƒ‚ntd| ƒ‚dS )zSGiven a binary dump as given by GNU od -b, look for long double
    representation.rN   é    Né   r   iøÿÿÿé   é   ZINTEL_EXTENDED_12_BYTES_LEZMOTOROLA_EXTENDED_12_BYTES_BEr€   ZINTEL_EXTENDED_16_BYTES_LEZIEEE_QUAD_BEZIEEE_QUAD_LEZIBM_DOUBLE_DOUBLE_LEZIBM_DOUBLE_DOUBLE_BErs   ZIEEE_DOUBLE_LEZIEEE_DOUBLE_BEzUnrecognized format (%s)zCould not lock sequences (%s))ÚsplitÚpoprj   Ú
_AFTER_SEQÚcopyÚ_BEFORE_SEQÚ_INTEL_EXTENDED_12BÚ_MOTOROLA_EXTENDED_12BÚ_INTEL_EXTENDED_16BÚ_IEEE_QUAD_PREC_BEÚ_IEEE_QUAD_PREC_LEÚ_IBM_DOUBLE_DOUBLE_LEÚ_IBM_DOUBLE_DOUBLE_BEÚ_IEEE_DOUBLE_LEÚ_IEEE_DOUBLE_BEr   )Úlinesrv   Zsawr}   Úwr   r   r	   rh   e  s@    




rh   c             C   s>   |   ¡  |  t d¡dd¡}|s$dS |  t d¡dd¡}| S )a‰  
    On our arm CI, this fails with an internal compilation error

    The failure looks like the following, and can be reproduced on ARM64 GCC 5.4:

        <source>: In function 'right_shift':
        <source>:4:20: internal compiler error: in expand_shift_1, at expmed.c:2349
               ip1[i] = ip1[i] >> in2;
                      ^
        Please submit a full bug report,
        with preprocessed source if appropriate.
        See <http://gcc.gnu.org/bugs.html> for instructions.
        Compiler returned: 1

    This function returns True if this compiler bug is present, and we need to
    turn off optimization for the function
    zF        __attribute__((optimize("O3"))) void right_shift() {}
        NFao          typedef long the_type;  /* fails also for unsigned and long long */
        __attribute__((optimize("O3"))) void right_shift(the_type in2, the_type *ip1, int n) {
            for (int i = 0; i < n; i++) {
                if (in2 < (the_type)sizeof(the_type) * 8) {
                    ip1[i] = ip1[i] >> in2;
                }
            }
        }
        )r_   Ztry_compileÚtextwrapÚdedent)rk   Zhas_optimizeZno_errr   r   r	   Ú-check_for_right_shift_internal_compiler_error   s    	r—   )-r   r    rˆ   r•   Znumpy.distutils.misc_utilr   ZC_ABI_VERSIONZC_API_VERSIONÚWarningr   r   r   r$   ZMANDATORY_FUNCSZOPTIONAL_STDFUNCSZOPTIONAL_HEADERSZOPTIONAL_INTRINSICSZOPTIONAL_FUNCTION_ATTRIBUTESZ,OPTIONAL_FUNCTION_ATTRIBUTES_WITH_INTRINSICSZOPTIONAL_VARIABLE_ATTRIBUTESZOPTIONAL_STDFUNCS_MAYBEZ	C99_FUNCSZC99_FUNCS_SINGLEZC99_FUNCS_EXTENDEDZC99_COMPLEX_TYPESZC99_COMPLEX_FUNCSrL   rR   rT   ro   r`   ri   r‰   r‡   r’   r‘   rŠ   rŒ   r‹   r   rŽ   r   r   rh   r—   r   r   r   r	   Ú<module>   s¸   



?;