o
    1ήc                     @   s   d dl Zd dlZd dlmZ d dlZd dlZd dlmZmZm	Z	m
Z
mZmZmZ d dlmZ d dlmZ d dlmZ eddpKed	doKed
dZejdoXeoXed Zejje ddZdddZeeZG dd dZdS )    N)path)
c_longlongc_doublec_floatc_intcastpointerPOINTER)assert_array_max_ulp)_glibc_older_than)__cpu_features__AVX512FFFMA3AVX2linuxz2.17z;avoid testing inconsistent platform library implementations)reason
np.float32c                 C   sV   t | d}|dkrtt|}t|tt}|jj	S tt|}t|tt}|jj	S )N   z
np.float64)
intr   r   r   r	   r   r   r   contentsvalue)sdatatypeicpfp r   K/tmp/pip-target-vg8gfxp4/lib/python/numpy/core/tests/test_umath_accuracy.pyconvert   s   
r   c                   @   s   e Zd Zedd ZdS )TestAccuracyc              
   C   s  t jdd tttd}t|}tt	dd |}|D ]}t||}t
|}dd |D }t j|dddtfd	d
dd}t|d dd }tt |}	t |d D ]T}
||d |
k }t jt|d t|d tt|
d}t jt|d t|d tt|
d}t jt|}|| }|| }|d  }t|	||| qZW d    n1 sw   Y  q W d    d S 1 sw   Y  d S )Nignore)alldatac                 S   s
   |  dS )Nz.csv)endswith)fr   r   r   <lambda>)   s   
 z<TestAccuracy.test_validate_transcendentals.<locals>.<lambda>c                 s   s     | ]}|d  dvr|V  qdS )r   )$#Nr   ).0rr   r   r   	<genexpr>-   s    z=TestAccuracy.test_validate_transcendentals.<locals>.<genexpr>z|S39)typeinputoutputulperr,   )dtypenames	delimiterskip_headerr   -   r+   r,   )r1   r-   r.   )nperrstater   joindirname__file__oslistdirlistfilteropen
genfromtxtr   splitextsplitgetattruniquearraystr_to_floatastypestrevalrandompermutationlenmaxr
   )selfdata_dirfilesfilenamefilepathfidfile_without_commentsr"   npnamenpfuncr   data_subsetinvaloutvalperm	maxulperrr   r   r   test_validate_transcendentals$   s<   



,,"z*TestAccuracy.test_validate_transcendentalsN)__name__
__module____qualname__platform_skipr]   r   r   r   r   r   #   s    r   )r   ) numpyr7   r<   r   syspytestctypesr   r   r   r   r   r   r	   numpy.testingr
   numpy.testing._private.utilsr   numpy.core._multiarray_umathr   getIS_AVXplatform
startswithruntestmarkskipifra   r   	vectorizerG   r   r   r   r   r   <module>   s.    $


