Current File : //usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyc
�
E�`Qc@s�ddlZddlZddlTddljjZddlZej	dd�Z
zOejeej
d��jdkp�ejeejd��jejkZWdej	e
�Xejjd�p�eZd�Zdefd	��YZd
efd��YZdefd
��YZdefd��YZdefd��YZdefd��YZed�Zed�Z e!dkr�e"�ndS(i����N(t*talltignoreitlinuxcCstjtd�|�S(Ns�Numpy is using complex functions (e.g. sqrt) provided by yourplatform's C library. However, they do not seem to behave accordingto C99 -- so C99 tests are skipped.(tdectskipiftskip_complex_tests(tfunc((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt
platform_skips	tTestCexpcBs;eZd�Zed��Zejed�d��ZRS(ccs�t}tj}||ddtjd�dtfV||ddtjd�tjd�tfVtjd�tjtjd�tjd��}||dd|j|jtfVdS(Nii(	tcheck_complex_valuetnptexptFalsetcostsintcomplextrealtimag(tselftchecktftref((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyttest_simple s	#,1c#st}tj�|�tjdddtfV|�tjdddtfV|�dtjtjtjfV|�dtjtjtjfV|�dtjtjtjfV|�tjdtjdfVtjtj	d�tj
d��}|�tjdtjtjfVtjtj	tjd�tj
tjd��}|�tjdtjtjtjfVtjtj	d�tj
d��}|�tjdtjtjfVtjtj	tjd�tj
tjd��}|�tjdtjtjtjfV�fd�}|dfV�fd�}|dfV�fd�}|dfV�fd	�}|dfV|�tjdtjtjfV|�tjdtjtjfV|�tjtjtjtjfV|�tjtjtjtjfV|�tjtjtjtjfVdS(
Niii����g�?g�?cs�d}tjdd�}zi�tjtjtjtj���}|jdksa|jdkr�t||j|jf��nWdtj|�XdS(Ns0cexp(-inf, inf) is (%f, %f), expected (+-0, +-0)tinvalidRi(RtseterrtarrayRtinfRRtAssertionError(tdummytmsgformterrtz(R(sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt_check_ninf_infMs(#cs�d}tjdd�}zp�tjtjtjtj���}tj|j�shtj|j�r�t	||j|jf��nWdtj|�XdS(Ns1cexp(inf, inf) is (%f, %f), expected (+-inf, nan)RR(
RRRRRtisinfRtisnanRR(RRRR (R(sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt_check_inf_infZs'&#cs�d}tjdd�}zi�tjtjtjtj���}|jdksa|jdkr�t||j|jf��nWdtj|�XdS(Ns0cexp(-inf, nan) is (%f, %f), expected (+-0, +-0)RRi(	RRRRRtnanRRR(RRRR (R(sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt_check_ninf_nangs(#cs�d}tjdd�}zp�tjtjtjtj���}tj|j�shtj|j	�r�t
||j|j	f��nWdtj|�XdS(Ns2cexp(-inf, nan) is (%f, %f), expected (+-inf, nan)RR(RRRRRR%R"RR#RR(RRRR (R(sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt_check_inf_nants'&#(
R
RRtPZEROR
tNZERORR%RRRtpitNone(RRRR!R$R&R'((RsI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyttest_special_values*s:	   $!2($ 2(



  #$s/cexp(nan + 0I) is wrong on most implementationsccs!tttjdtjdfVdS(Ni(RRRR%(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyttest_special_values2�s(	t__name__t
__module__RRR,RtknownfailureiftTrueR-(((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR	s	
atTestClogcBs>eZd�Zeejej�dkd�d���ZRS(cCs�tjddg�}tjtj|��dtj|�}tj|�}x/tt|��D]}t||||�q`WdS(Niyy@y�?y�?y�?@(RRtlogtabstangletrangetlentassert_almost_equal(Rtxty_rtyti((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR�s
)tarmv5telsSee gh-413.c	Cs�g}g}tjdd�}zwtjtjgdtj�}tjtjtj�}|jttj	|�tjdd�t
tj	|�|�Wdtj|�X|j|�|j|�tjdd�}zqtjdgdtj�}tjtjd�}|jttj	|�tjdd�t
tj	|�|�Wdtj|�X|j|�|j|�tjtdtj�gdtj�}tjtjdtj�}t
tj	|�|�|j|�|j|�tjtdtj�gdtj�}t
tj	|�|�|j|�|j|�tjd	d�}zitjtd
tj�gdtj�}tjtjtj�}tjd	d�t
tj	|�|�Wdtj|�X|j|�|j|�tjd	d�}zStjtjdtjgdtj�}tjd	d�t
tj	|�|�Wdtj|�X|j|�|j|�tjtjdgdtj�}tjtjtj�}t
tj	|�|�|j|�|j|�tjtjdgdtj�}tjtjd�}t
tj	|�|�|j|�|j|�tjttjtj�gdtj�}tjtjdtj�}t
tj	|�|�|j|�|j|�tjttjtj�gdtj�}tjtjd
tj�}t
tj	|�|�|j|�|j|�tjttjtj�gdtj�}tjtjtj�}t
tj	|�|�|j|�|j|�tjttjtj�gdtj�}t
tj	|�|�|j|�|j|�tjttjd�gdtj�}tjtjtj�}t
tj	|�|�|j|�|j|�tjttjtj�gdtj�}tjtjtj�}t
tj	|�|�|j|�|j|�tjttjtj�gdtj�}tjtjtj�}t
tj	|�|�|j|�|j|�tj|dtj�}tj|dtj�}tjdd�}zZxSt
t|��D]?}t
tj	tj||��tjtj	||���q�WWdtj|�XdS(NtdividetraisetdtypeRiig�?i����Rg�?y�?g�?g�?(RRRR)RRR*tassertRaisestFloatingPointErrorR3R8tappendR%R6R7tconj(	RtxltylRR9R;txatyaR<((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR,�s�



'

'

'

)

#

"

+

*

*

+

'

*

*

A(	R.R/RRRRtplatformtmachineR,(((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR2�s	t	TestCsqrtcBs)eZd�Zd�Zed��ZRS(ccsottjddddfVttjdddtjd�dtjd�tfVttjddddfVdS(Niig�?ii����(R
RtsqrtR
(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR2s7ccsQtjtjtjdd���}d�}t|dd|j|jtfVdS(NicSstjtj|��S(N(RRLRD(R ((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR>s(RRDRLRR
RRR
(RRR((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyttest_simple_conjugate<s$	ccs�t}tj}gg}}||tjdddfV||tjdddfV||dtjtjtjfV||dtjtjtjfV||tjtjtjtjfV||tjtjtjtjfV||tjtjtjtjfV||tjtjtjtjfV||tjtjtjtjfV||dtjtjtjfV||dtjtjtjfV||dtjtjtjfV||tjdtjtjfV||tjdtjtjfVd�}|dfV||tjtjtjtjfV||tjdtjtjfV||tjdtjtjfV||tjtjtjtjfVdS(Niii����cSs�d}tjtjtjtjtj���}tjdd�}zGtj|j�ogtj	|j
�s�t||j|j
f��nWdtj|�XdS(Ns3csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)RR(RRLRRRR%RR#RR"RR(RRR R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR&gs+$#(R
RRLR(R)RR%R+(RRRR9R;R&((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR,Es.	
  ###$$   ! 	#  (R.R/RRMRR,(((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyRK0s	
		tTestCpowcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCstjdd�|_dS(NRR(RRtolderr(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pytsetUp�scCstj|j�dS(N(RRRO(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyttearDown�scCsvtjdddtjtjg�}|d}tj|d�}x/tt|��D]}t||||�qSWdS(	Niy�?iy@iy�?�?y@y�?@(RRRR%tpowerR6R7R8(RR9R:R;R<((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR�s
$
cCs�tjddddtjtjg�}tjddd
dddg�}tt|��}g|D]$}t||�t||�^qa}ttjtj�|d	<g|D]}||||^q�}x-|D]%}t||||d
d|�q�WdS(Niy�?ig@y�G�z��?g�y�?iiterr_msgsLoop %d
y@�G�z��?y��?y��?(RRRR%R6R7RR8(RR9R;tlxR<tp_rtn_r((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyttest_scalar�s'!1%
cCs�tjddddtjtjg�}tjddd
dddg�}tt|��}g|D]$}t||�t||�^qa}ttjtj�|d	<||}x-|D]%}t||||d
d|�q�WdS(Niy�?ig@y�G�z��?g�y�?iiRSsLoop %d
y@�G�z��?y��?y��?(RRRR%R6R7RR8(RR9R;RTR<RURV((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt
test_array�s'!1

(R.R/RPRQRRWRX(((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyRN�s
				
tTestCabscBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCstjdd�|_dS(NRR(RRRO(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyRP�scCstj|j�dS(N(RRRO(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyRQ�scCs�tjdd	d
tjtjg�}tjtjd�dtjd�tjtjg�}tj|�}x/tt|��D]}t||||�q|WdS(Niy�?iy@g@iiy�?�?y@y�?@(	RRRR%RLR4R6R7R8(RR9R:R;R<((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR�s
$6cCstjdgdtj�}ttj|�tj|��tjtdtj�gdtj�}ttj|�tj|��tjttjtj�gdtj�}ttj|�tj|��tjttjtj�gdtj�}ttj|�tj|��dS(NiyR@y�?(	RRRtassert_array_equalR4RR)RR%(RR9((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt	test_fabs�s'**ccs�gg}}|jtj�|jtj�ttjtjtjtjfV|jtj�|jtj�ttjtjtjtjfV|jtj�|jtj�ttjtjtjtjfV|jtj�|jtj�ttjtjtjtjfVd�}d�}tj|dtj�}xMtt	|��D]9}|||||�}t||||||fVqNWdS(NcSstjtj|��S(N(RR4RD(ta((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR�scSstjtj||��S(N(RR4R(R\tb((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pytg�sR@(
RCRR%tcheck_real_valueR4RRRR6R7(RR9R;RR^RGR<R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyttest_cabs_inf_nan�s&
 ! !		(R.R/RPRQRR[R`(((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyRY�s
				tTestCargcBs5eZd�Zejed�d��Zd�ZRS(cCs|ttjdddt�ttjdddtjt�ttjdddtjt�ttjtjtjtj�dS(Niig�?g�?(R_tncut_argR
RR*R((R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR�s  sCComplex arithmetic with signed zero is buggy on most implementationccs�ttjtjtjtjtfVttjtjtjtjtfVttjtjtjtjfVttjtjtjtjfVttjdtjtjtfVttjdtjtjtfVttjdtjtjtfVttjdtjtjtfVttjtjddtjtfVttjtjddtjtfVttjtjddtjtfVttjtjddtjtfVdS(Nii����g�?g�(R_RbRcRR)R(R*R
(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt	test_zero�s#$     !$$$ccs�ttjtjdtjtfVttjtjdtjtfVttjtjdtjtfVttjtjdtjtfVttjdtjdtjtfVttjdtjdtjtfVttjtjtjdtjtfVttjtjtjdtjtfVttjtjtjdtjtfVttjtjtjdtjtfVttjtj	d	tj	tfVttjd	tj	tj	tfVttjtj	tjtj	tfVttjtjtj	tj	tfVdS(
Nii����g�?g�g�?g�g�?gпi(
R_RbRcRRR*R
R(R)R%(R((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR,s!"  $%()'(  #(R.R/RRR0R1RdR,(((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyRa�s		cCsNtjt||�g�}|r7t||�|�nt||�|�dS(N(RRRtassert_equalR8(Rtx1ty1R9texacttz1((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR_'sc	Cs�tjdd�}tjt||�g�}tj||�}z3|r^t||�|�nt||�|�Wdtj|�XdS(NRR(RRRRReR8(	RRfRgtx2ty2RhRRitz2((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyR
.st__main__(#tsysRIt
numpy.testingtnumpy.core.umathtcoretumathRbtnumpyRRRORRRRR3R)R*tfunctions_seem_flakyt
startswithRRtobjectR	tTestCaseR2RKRNRYRaR1R_R
R.trun_module_suite(((sI/usr/lib64/python2.7/site-packages/numpy/core/tests/test_umath_complex.pyt<module>s*
	$+	r�P(=B