U
    ?h?L  ã                (   @   s"  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i Zdd„ ZdD ]LZee e¡je ƒ.ZeD ]"Ze d¡r’q‚e ¡ sœq‚eeƒ q‚W 5 Q R X qdd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/d0d1d2d3d4d5d6g(Zd7gZd8d9d:gZd;d<gZd=d>gZd8d9gZd?d@dAgZdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSgZdTdUdVdWdXdYdZd[d\g	Zd]d^d_d`dadbdcdddedfdgdhdidjdkdldmgZ dndodpdqgZ!drdsdtdugZ"dvdwdxgZ#dydz„ Z$d{d|„ Z%d}d~„ Z&dd€„ Z'dZ(d‚dƒ„ Z)d„d„d„d„d„d„d„d„d…d†d‡dˆd‰dŠd‹dŒgZ*ddŽddd‘d’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œddždŸd„d„gZ.d„d„d„d„dšd›dœddždŸd„d„d„d„d„d„gZ/dŸdžd„d„ddœd›dšd„d„d„d„gZ0dŸdžd d¡d‡d¢d„d„d„d„d„d„d„d„d„d„gZ1e1ddd™… Z2d•d–d—d˜d’d„d„d„gd„gd£  Z3d„d„d„d’d˜d—d–d•gd„gd£  Z4d¤d¥„ Z5d¦d§„ Z6dS )¨é    N)Úmingw32i	  é   c                   @   s   e Zd ZdS )ÚMismatchCAPIErrorN)Ú__name__Ú
__module__Ú__qualname__© r   r   úI/var/www/html/venv/lib/python3.8/site-packages/numpy/core/setup_common.pyr   5   s   r   c                 C   sN   t j d|¡ z(tdƒ}tdƒ}| |j¡}| ¡ }W 5 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_api)ÚsysÚpathÚinsertÚ
__import__Zfullapi_hashZfull_apiZget_versions_hash)Ú
apiversionÚcodegen_dirÚmr
   Úcurapi_hashZ	apis_hashr   r   r	   Úget_api_versions9   s    

r   c              	   C   s@   t | |ƒ\}}||ks<d| › d|› d|› dt› d	}t|ƒ‚dS )z@Emits a MismatchCAPIWarning if the C API version needs updating.z^API mismatch detected, the C API version numbers have to be updated. Current C api version is z, with checksum z=, but recorded checksum in core/codegen_dir/cversions.txt is zL. If functions were added in the C API, you have to update C_API_VERSION in Ú.N)r   Ú__file__r   )r   r   r   Zapi_hashÚmsgr   r   r	   Úcheck_api_versionN   s    r   c                 C   s\   |   d¡\}}}| d¡d }| d¡d }dd„ | d¡D ƒ}d	 d
d„ |D ƒ¡t|< d S )Nú(ú)r   ú éÿÿÿÿc                 S   s   g | ]}|  ¡ ‘qS r   )Ústrip©Ú.0Úargr   r   r	   Ú
<listcomp>h   s     zset_sig.<locals>.<listcomp>ú,z, c                 s   s   | ]}d | V  qdS )z(%s){0}Nr   r   r   r   r	   Ú	<genexpr>j   s     zset_sig.<locals>.<genexpr>)Ú	partitionÚ
rpartitionÚsplitÚjoinÚFUNC_CALL_ARGS)ÚsigÚprefixÚ_ÚargsÚfuncnamer   r   r	   Úset_sigd   s
    r-   )zfeature_detection_locale.hzfeature_detection_math.hzfeature_detection_cmath.hzfeature_detection_misc.hzfeature_detection_stdio.hú#Ú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ÚcopysignZ	nextafterZstrtollZstrtoullZcbrtÚlog2ÚpowÚhypotÚatan2ZcrealZcimagZconjZ	strtold_lZftelloZfseekoZ	fallocateZ	backtraceÚmadviseZ__threadz__declspec(thread)zcomplex doublezcomplex floatzcomplex long doubleZcabsZcacosZcacoshZcargZcasinZcasinhZcatanZcatanhZcexpZclogZcpowZcsqrtZcsinZcsinhZccosZccoshZctanZctanhúxmmintrin.húemmintrin.húimmintrin.hz
features.hz	xlocale.hzdlfcn.hz
execinfo.hzlibunwind.hz
sys/mman.h)Z__builtin_isnanú5.)Z__builtin_isinfrR   )Z__builtin_isfiniterR   )Z__builtin_bswap32Ú5u)Z__builtin_bswap64rS   )Z__builtin_expectz5, 0)Z__builtin_mul_overflowz(long long)5, 5, (int*)5)Z_m_from_int64Ú0rP   )Z_mm_load_psz	(float*)0rO   )Z_mm_prefetchz(float*)0, _MM_HINT_NTArO   )Z_mm_load_pdz
(double*)0rP   )Z__builtin_prefetchz(float*)0, 0, 3)ú__asm__ volatilez"vpand %xmm1, %xmm2, %xmm3"ústdio.hZLINK_AVX)rU   z"vpand %ymm1, %ymm2, %ymm3"rV   Z	LINK_AVX2)rU   z"vpaddd %zmm1, %zmm2, %zmm3"rV   ZLINK_AVX512F)rU   z²"vfpclasspd $0x40, %zmm15, %k6\n"                                             "vmovdqu8 %xmm0, %xmm1\n"                                             "vpbroadcastmb2q %k0, %xmm0\n"rV   ZLINK_AVX512_SKX)rU   z"xgetbv"rV   ZXGETBV)z)__attribute__((optimize("unroll-loops")))Zattribute_optimize_unroll_loops)z__attribute__((optimize("O3")))Zattribute_optimize_opt_3)z__attribute__((optimize("O2")))Zattribute_optimize_opt_2)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)úG__attribute__((target ("avx512f,avx512dq,avx512bw,avx512vl,avx512cd")))Zattribute_target_avx512_skx)z#__attribute__((target("avx2,fma")))Z%attribute_target_avx2_with_intrinsicszO__m256 temp = _mm256_set1_ps(1.0); temp =     _mm256_fmadd_ps(temp, temp, temp)rQ   )z"__attribute__((target("avx512f")))Z(attribute_target_avx512f_with_intrinsicsz7__m512i temp = _mm512_castps_si512(_mm512_set1_ps(1.0))rQ   )rW   Z+attribute_target_avx512_skx_with_intrinsicszÎ__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))rQ   c                 C   s   d|   ¡  S )NzHAVE_%s)Úupper)Únamer   r   r	   Ú	fname2def  s    rZ   c                 C   s   |   dd¡}| ¡ S )Nr   Ú ©ÚreplacerX   ©ÚsymbolZdefiner   r   r	   Úsym2def  s    r`   c                 C   s   |   dd¡}| ¡ S )Nr   r*   r\   r^   r   r   r	   Útype2def  s    ra   c              	   C   sN  |   ¡  tddi }tjdkrRtƒ sRz| 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Šztt|ƒƒ}|W W ¢tS  t	k
r:   | dd¡}|d7 }|  |d d d¡\}}| j d¡ | j |gd¡ ttdƒƒ}| Y W ¢S X W 5 |  ¡  X d S )NÚtypezlong doubleÚwin32z/GLÚintelz-ipoz -ipor[   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   re   Zcompile_optionsÚremoveÚAttributeErrorÚ
ValueErrorÚcompiler_typeÚ
startswithZcc_exer]   Úset_executablesÚ_compileZ_cleanÚlong_double_representationÚpyodZ
temp_filesÚappendZlink_executable)ÚcmdÚbodyZnewcompilerÚsrcÚobjZltyper   r   r	   Ú check_long_double_representation  sB    
ÿ
þû	
r}   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 5 Q R X tdt|ƒdƒD ]N}dtt|ƒdd… ƒ g}| d	d„ |||d … D ƒ¡ | d
 |¡¡ q<|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 )é   N)Úoct)r   Úor   r   r	   r    b  s     zpyod.<locals>.<listcomp>r   r   z%07dr   Nc                 S   s   g | ]}d t |ƒ ‘qS )z%03d)Úint)r   rj   r   r   r	   r    e  s     r   )	ÚopenÚreadÚrangeÚlenr‚   r€   Úextendrx   r&   )ÚfilenameÚoutZfidZyo2ÚiÚliner   r   r	   rw   N  s     rw   Z000Z001Z043Z105Z147Z211Z253Z315Z357Z376Z334Z272Z230Z166Z124Z062Z020Z301Z235Z157Z064r   Z240Z242Z171Z353Z031Z300Z326Z363Ú100é   c                 C   s®  dgd }d}| D ]p}|  ¡ dd… D ]X}| d¡ | |¡ |dd… tkr(t |¡}|dd… tdd… kr¦|dd… tkrŒ  d	S |dd… tkr¤  d
S q(|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r‚  dS q(|dd… tkr(|dd… tkrj  dS |dd… tkr(  dS q(q|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.r[   é    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_BEr   ZIEEE_DOUBLE_LEZIEEE_DOUBLE_BEzUnrecognized format (%s)zCould not lock sequences (%s))r%   Úpoprx   Ú
_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_BErq   )Úlinesr„   Zsawr‹   Úwr   r   r	   rv   ~  s@    







rv   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;
                }
            }
        }
        )rl   Ztry_compileÚtextwrapÚdedent)ry   Zhas_optimizeZno_errr   r   r	   Ú-check_for_right_shift_internal_compiler_error¹  s     þ	 ÷
r£   )7r”   Úpathlibr   r¡   Znumpy.distutils.misc_utilr   ZC_ABI_VERSIONZC_API_VERSIONrq   r   r   r   r'   r-   Úfilerƒ   ÚPathr   ÚparentÚfr‹   rs   r   ZMANDATORY_FUNCSZOPTIONAL_LOCALE_FUNCSZOPTIONAL_FILE_FUNCSZOPTIONAL_MISC_FUNCSZOPTIONAL_VARIABLE_ATTRIBUTESZOPTIONAL_FUNCS_MAYBEZC99_COMPLEX_TYPESZC99_COMPLEX_FUNCSZOPTIONAL_HEADERSZOPTIONAL_INTRINSICSZOPTIONAL_FUNCTION_ATTRIBUTESZ OPTIONAL_FUNCTION_ATTRIBUTES_AVXZ0OPTIONAL_FUNCTION_ATTRIBUTES_WITH_INTRINSICS_AVXrZ   r`   ra   r}   rm   rw   r•   r“   rž   r   r–   r˜   r—   r™   rš   rœ   r›   rv   r£   r   r   r   r	   Ú<module>   s„  	
                                ø
 ÿ  ÿ               û
öå!ú
úö/       ÿ   ÿ       ÿ     ÿ       ÿÿÿ;