o
    gHd?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 ]0Zeeeje ZeD ]ZedrIqAe sNqAee qAW d   n1 s]w   Y  q2g dZdgZg dZddgZddgZddgZg dZg dZg dZg dZ g 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,Z,e,ddd- Z-g d.Z.g d/Z/g d0Z0g d1Z1e1ddd- Z2g d,d2gd3  Z3g d4d2gd3  Z4d5d6 Z5d7d8 Z6dS )9    N)mingw32i	     c                   @   s   e Zd ZdS )MismatchCAPIErrorN)__name__
__module____qualname__ r   r   ^/var/www/html/facialservice/flask-venv/lib/python3.10/site-packages/numpy/core/setup_common.pyr   5   s    r   c                 C   sV   t jd| ztd}td}||j}| }W t jd= nt jd= w |||  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   genapi	numpy_api)syspathinsert
__import__fullapi_hashfull_apiget_versions_hash)
apiversioncodegen_dirmr   curapi_hash	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   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
   r3   )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atanhrinttruncexp2copysign	nextafterstrtollstrtoullcbrtlog2powhypotatan2crealcimagconj	strtold_l)ftellofseeko	fallocate	backtracemadvise__threadz__declspec(thread)r^   r_   )zcomplex doublezcomplex floatzcomplex long double)cabscacoscacoshcargcasincasinhcatancatanhcexpclogcpowcsqrtcsincsinhccosccoshctanctanh)	xmmintrin.hemmintrin.himmintrin.hz
features.hz	xlocale.hzdlfcn.hz
execinfo.hzlibunwind.hz
sys/mman.h))__builtin_isnan5.)__builtin_isinfrz   )__builtin_isfiniterz   )__builtin_bswap325u)__builtin_bswap64r~   )__builtin_expectz5, 0)__builtin_mul_overflowz(long long)5, 5, (int*)5)_m_from_int640rw   )_mm_load_psz	(float*)0rv   )_mm_prefetchz(float*)0, _MM_HINT_NTArv   )_mm_load_pdz
(double*)0rw   )__builtin_prefetchz(float*)0, 0, 3)__asm__ volatilez"vpand %xmm1, %xmm2, %xmm3"stdio.hLINK_AVX)r   z"vpand %ymm1, %ymm2, %ymm3"r   	LINK_AVX2)r   z"vpaddd %zmm1, %zmm2, %zmm3"r   LINK_AVX512F)r   z"vfpclasspd $0x40, %zmm15, %k6\n"                                             "vmovdqu8 %xmm0, %xmm1\n"                                             "vpbroadcastmb2q %k0, %xmm0\n"r   LINK_AVX512_SKX)r   z"xgetbv"r   XGETBV))z)__attribute__((optimize("unroll-loops")))attribute_optimize_unroll_loops)z__attribute__((optimize("O3")))attribute_optimize_opt_3)z__attribute__((optimize("O2")))attribute_optimize_opt_2)z__attribute__((nonnull (1)))attribute_nonnull))z__attribute__((target ("avx")))attribute_target_avx)z __attribute__((target ("avx2")))attribute_target_avx2)z#__attribute__((target ("avx512f")))attribute_target_avx512f)G__attribute__((target ("avx512f,avx512dq,avx512bw,avx512vl,avx512cd")))attribute_target_avx512_skx))z#__attribute__((target("avx2,fma")))%attribute_target_avx2_with_intrinsicszO__m256 temp = _mm256_set1_ps(1.0); temp =     _mm256_fmadd_ps(temp, temp, temp)rx   )z"__attribute__((target("avx512f")))(attribute_target_avx512f_with_intrinsicsz7__m512i temp = _mm512_castps_si512(_mm512_set1_ps(1.0))rx   )r   +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))rx   c                 C   s   d|    S )NzHAVE_%s)upper)namer   r   r	   	fname2def  s   r   c                 C      |  dd}| S )Nr     replacer   symboldefiner   r   r	   sym2def     r   c                 C   r   )Nr    r0   r   r   r   r   r	   type2def  r   r   c              	   C   sJ  |    tddi }tjdkr't s'z	| jjd W n2 tt	fy&   Y n(w tjdkrN| jj
drNd| jjv rN| jjdd}| jj|||||d	 d
 | |d d d\}}zGztt|}|W W |   S  t	y   |dd}|d7 }| |d d d\}}| jd | j|gd ttd}| Y W |   S w |   w )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]; }
_configtest)_check_compilerLONG_DOUBLE_REPRESENTATION_SRCr   platformr   r   compile_optionsremoveAttributeError
ValueErrorcompiler_type
startswithcc_exer   set_executables_compilelong_double_representationpyod_clean
temp_filesappendlink_executable)cmdbodynewcompilersrcobj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 sw   Y  tdt|dD ]'}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>Nr   r   z%07dr   c                 S   s   g | ]}d t | qS )z%03d)int)r$   r   r   r   r	   r&   e  s    r    )	openreadrangelenr   r   extendr   r,   )filenameoutfidyo2iliner   r   r	   r   N  s    r   )000r   r   r   r   r   r   r   001043105147211253315357)376334272230166124062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   326363r   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 ]}|  dd D ]}|d || |dd tkrt|}|dd tdd krQ|dd tkrD  d	S |dd tkrP  d
S q|dd tdd kr|dd tkri  dS |dd t	kru  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r  dS |dd tkr  dS qq	|durtd| td| )zSGiven a binary dump as given by GNU od -b, look for long double
    representation.r       N   r   i      INTEL_EXTENDED_12_BYTES_LEMOTOROLA_EXTENDED_12_BYTES_BEr   INTEL_EXTENDED_16_BYTES_LEIEEE_QUAD_BEIEEE_QUAD_LEIBM_DOUBLE_DOUBLE_LEIBM_DOUBLE_DOUBLE_BEr   IEEE_DOUBLE_LE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   sawr   wr   r   r	   r   ~  sH   



$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;
                }
            }
        }
        )r   try_compiletextwrapdedent)r   has_optimizeno_errr   r   r	   -check_for_right_shift_internal_compiler_error  s   	
r  )7r
  pathlibr   r  numpy.distutils.misc_utilr   C_ABI_VERSIONC_API_VERSIONr   r   r   r   r-   r3   filer   Pathr   parentfr   r   r"   MANDATORY_FUNCSOPTIONAL_LOCALE_FUNCSOPTIONAL_FILE_FUNCSOPTIONAL_MISC_FUNCSOPTIONAL_VARIABLE_ATTRIBUTESOPTIONAL_FUNCS_MAYBEC99_COMPLEX_TYPESC99_COMPLEX_FUNCSOPTIONAL_HEADERSOPTIONAL_INTRINSICSOPTIONAL_FUNCTION_ATTRIBUTES OPTIONAL_FUNCTION_ATTRIBUTES_AVX0OPTIONAL_FUNCTION_ATTRIBUTES_WITH_INTRINSICS_AVXr   r   r   r   r   r   r  r	  r  r  r  r  r  r  r  r  r  r   r  r   r   r   r	   <module>   sx   	

!
/;