a
    ³ÐOc©O  ã                	   @   s  d dl Z 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 ]`Zee e¡je ƒ�8ZeD ]"Ze d¡ršqŠe ¡ s¤qŠeeƒ qŠW d  ƒ ql1 sÂ0    Y  qlg d¢Zg d¢ZdgZg d¢ZddgZg d¢Zg d¢Zg d¢Zg d¢Z ddgZ!g d¢Z"g d¢Z#dd„ e#D ƒZ$dd„ e#D ƒZ%g d ¢Z&g d!¢Z'd"d#„ Z(d$d%„ Z)d&d'„ Z*d(d)„ Z+d*Z,d+d,„ Z-g d-¢Z.g d.¢Z/g d/¢Z0e0ddd0… Z1g d1¢Z2g d2¢Z3g d3¢Z4g d4¢Z5e5ddd0… Z6g d/¢d5gd6  Z7g d7¢d5gd6  Z8d8d9„ Z9d:d;„ Z:dS )<é    N)Úmingw32i	  é   c                   @   s   e Zd ZdS )ÚMismatchCAPIWarningN)Ú__name__Ú
__module__Ú__qualname__© r   r   úN/var/www/html/gsl.tools/lib/python3.9/site-packages/numpy/core/setup_common.pyr   3   s   r   c                 C   sV   t j d|¡ z0tdƒ}tdƒ}| |j¡}| ¡ }W t jd= n
t jd= 0 |||  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_versions7   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_versionL   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>g   ó    zset_sig.<locals>.<listcomp>ú,z, c                 s   s   | ]}d | V  qdS )z(%s) 0Nr   r    r   r   r	   Ú	<genexpr>h   r$   zset_sig.<locals>.<genexpr>)Ú	partitionÚ
rpartitionÚsplitÚjoinÚFUNC_CALL_ARGS)ÚsigÚprefixÚ_ÚargsÚfuncnamer   r   r	   Úset_sigc   s
    r1   )zfeature_detection_locale.hzfeature_detection_math.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ÚatanhÚrintÚtruncÚexp2Úlog2ÚhypotÚatan2ÚpowÚcopysignÚ	nextafterZstrtollZstrtoullÚcbrtZ	strtold_l)ÚftelloÚfseekoZ	fallocateZ	backtraceZmadvise)	ú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_isinfr[   )Z__builtin_isfiniter[   )Z__builtin_bswap32Ú5u)Z__builtin_bswap64r\   )Z__builtin_expectz5, 0)Z__builtin_mul_overflowz5, 5, (int*)5)Z_m_from_int64Ú0rY   )Z_mm_load_psz	(float*)0rX   )Z_mm_prefetchz(float*)0, _MM_HINT_NTArX   )Z_mm_load_pdz
(double*)0rY   )Z__builtin_prefetchz(float*)0, 0, 3)ú__asm__ volatilez"vpand %xmm1, %xmm2, %xmm3"ústdio.hZLINK_AVX)r^   z"vpand %ymm1, %ymm2, %ymm3"r_   Z	LINK_AVX2)r^   z"vpaddd %zmm1, %zmm2, %zmm3"r_   ZLINK_AVX512F)r^   z²"vfpclasspd $0x40, %zmm15, %k6\n"                                             "vmovdqu8 %xmm0, %xmm1\n"                                             "vpbroadcastmb2q %k0, %xmm0\n"r_   ZLINK_AVX512_SKX)r^   z"xgetbv"r_   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_intrinsicszk__m256 temp = _mm256_set1_ps(1.0); temp =                                 _mm256_fmadd_ps(temp, temp, temp)rZ   )z"__attribute__((target("avx512f")))Z(attribute_target_avx512f_with_intrinsicsz7__m512i temp = _mm512_castps_si512(_mm512_set1_ps(1.0))rZ   )r`   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))rZ   Z__threadz__declspec(thread))	rG   rH   rI   rK   rJ   rP   rS   rV   rW   )#r3   r4   r5   r6   r7   r8   r9   r:   r;   rL   rM   r<   r=   r>   rH   r?   rG   r@   rA   rB   rJ   rI   rK   rP   rQ   rR   rC   rD   rE   rF   rN   rO   rS   rT   rU   c                 C   s   g | ]}|d  ‘qS )Úfr   ©r!   ra   r   r   r	   r#   õ   r$   r#   c                 C   s   g | ]}|d  ‘qS )Úlr   rb   r   r   r	   r#   ö   r$   )zcomplex doublezcomplex floatzcomplex long double)Z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    rf   c                 C   s   |   dd¡}| ¡ S )Nr   Ú ©Úreplacerd   ©ÚsymbolZdefiner   r   r	   Úsym2def  s    rl   c                 C   s   |   dd¡}| ¡ S )Nr   r.   rh   rj   r   r   r	   Útype2def  s    rm   c              	   C   s^  |   ¡  tddi }tjdkrPtƒ sPz| jj d¡ W qž tt	fyL   Y qž0 nNtjdkrž| jj
 d¡ržd| jjv rž| jj dd¡}| jj|||||d	 d
� |  |d d d¡\}}zœztt|ƒƒ}|W W |  ¡  S  t	�yB   | dd¡}|d7 }|  |d d d¡\}}| j d¡ | j |gd¡ ttdƒƒ}| Y W |  ¡  S 0 W |  ¡  n
|  ¡  0 d S )NÚtypezlong doubleÚwin32z/GLÚintelz-ipoz -iporg   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   rq   Zcompile_optionsÚremoveÚAttributeErrorÚ
ValueErrorÚcompiler_typeÚ
startswithZcc_exeri   Úset_executablesÚ_compileÚlong_double_representationÚpyodZ_cleanZ
temp_filesÚappendZlink_executable)ÚcmdÚbodyZnewcompilerÚsrcÚobjZltyper   r   r	   Ú check_long_double_representation  sJ    
ÿ
þû	óþ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 d  ƒ n1 s60    Y  tdt|ƒdƒD ]N}dtt|ƒdd… ƒ g}| d	d„ |||d … D ƒ¡ | d
 |¡¡ qP|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)r!   Úor   r   r	   r#   a  r$   zpyod.<locals>.<listcomp>Nr   r   z%07dr   c                 S   s   g | ]}d t |ƒ ‘qS )z%03d)Úint)r!   rv   r   r   r	   r#   d  r$   r   )	ÚopenÚreadÚrangeÚlenr�   r‹   Úextendr„   r*   )ÚfilenameÚoutZfidZyo2ÚiÚliner   r   r	   rƒ   M  s    0 rƒ   )Ú000r—   r—   r—   r—   r—   r—   r—   Z001Z043Ú105Z147Z211Z253Z315Z357)Z376Z334Z272Z230Z166Ú124Z062Z020)Ú301Ú235Ú157Ú064r™   r—   r—   r—   r   )r—   r—   r—   r—   Ú240Ú242Ú171Ú353Ú031Ú300r—   r—   )r—   r—   r—   r—   rž   rŸ   r    r¡   r¢   r£   r—   r—   r—   r—   r—   r—   )r£   r¢   r—   r—   r¡   r    rŸ   rž   r—   r—   r—   r—   )r£   r¢   Z326Z363r˜   Z100r—   r—   r—   r—   r—   r—   r—   r—   r—   r—   r—   é   )r—   r—   r—   r™   r�   rœ   r›   rš   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u�ržtd| ƒ‚ntd| ƒ‚dS )zSGiven a binary dump as given by GNU od -b, look for long double
    representation.rg   é    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)   Úpopr„   Ú
_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}   )Úlinesr�   Zsawr–   Úwr   r   r	   r‚   }  s@    







r‚   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;
                }
            }
        }
        )rx   Ztry_compileÚtextwrapÚdedent)r…   Zhas_optimizeZno_errr   r   r	   Ú-check_for_right_shift_internal_compiler_error¸  s    þ	÷
rº   );r«   Úpathlibr   r¸   r   Znumpy.distutils.misc_utilr   ZC_ABI_VERSIONZC_API_VERSIONÚWarningr   r   r   r+   r1   ÚfilerŽ   ÚPathr   Úparentra   r–   r   r   ZMANDATORY_FUNCSZOPTIONAL_STDFUNCSZOPTIONAL_LOCALE_FUNCSZOPTIONAL_FILE_FUNCSZOPTIONAL_MISC_FUNCSZ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_FUNCSrf   rl   rm   r‰   ry   rƒ   r¬   rª   rµ   r´   r­   r¯   r®   r°   r±   r³   r²   r‚   rº   r   r   r   r	   Ú<module>   sv   
*/ÿÿ;