• File: test_classes.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyc
  • Date Modified: 12/19/2017 2:16 PM
  • File size: 19.68 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

9Zc@`sdZddlmZmZmZddlZddlmZddl	Z
ddlmZm
Z
mZmZmZmZddlmZmZmZmZmZddlmZee
eeeefZdZe
jjZd	d
ZdZdZd
Z dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2d Z3d!Z4d"Z5d#Z6d$Z7d%Z8e9d&krendS('sTest inter-conversion of different polynomial classes.

This tests the convert and cast methods of all the polynomial classes.

i(tdivisiontabsolute_importtprint_functionN(tNumber(t
PolynomialtLegendret	ChebyshevtLaguerretHermitetHermiteE(tassert_almost_equalt
assert_raisestassert_equaltassert_trun_module_suite(tlongcc`sfx;tD]3}x*tD]"}t||fVt||fVqWqWx!tD]}t|fVt|fVt|fVt|fVt|fVt|fVt	|fVt
|fVt|fVt|fVt
|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVt|fVqEWdS(N(tclassestcheck_conversiont
check_castt
check_calltcheck_identitytcheck_basistcheck_fromrootst	check_fittcheck_equaltcheck_not_equalt	check_addt	check_subt	check_multcheck_floordivt
check_truedivt	check_modtcheck_divmodt	check_powtcheck_integtcheck_derivtcheck_rootstcheck_linspacetcheck_mapparmstcheck_degreet
check_copytcheck_cutdegtcheck_truncatet
check_trim(tPoly1tPoly2tPoly((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyttest_class_methodss<


tcC`syUttj|j|jkttj|j|jkt|j|jWn/tk
rd||ff}t|nXdS(NsResult: %s
Target: %s(R
tnptalltdomaintwindowR
tcoeftAssertionError(tp1tp2tmsg((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pytassert_poly_almost_equal@s
c
C`stjddd}td
}|jtdd}|jtdd}||d|d|}|jtd
d}|jtdd}|jd	|d|d|}	t|	j|t|	j|t|	|||dS(Niii
iig?R3R4tkind(i(i(i(i(i(R1tlinspacetrandomR3R4tconvertR
(
R,R-txR5td1tw1R7td2tw2R8((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyROsc
C`stjddd}td	}|jtd
d}|jtdd}||d|d|}|jtdd}|jtd
d}|j|d|d|}	t|	j|t|	j|t|	|||dS(Niii
iig?R3R4(i(i(i(i(i(R1R<R=R3R4tcastR
(
R,R-R?R5R@RAR7RBRCR8((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR`scC`s|jtdd}|jtd	d}tj|d|dd}|jd|d|}t|j|t|j|t|||dS(
Nig?iiiR3R4(i(i(R3R=R4R1R<tidentityRR
(R.tdtwR?tp((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRvscC`s|jtdd}|jtd	d}|jdd|d|}t|j|t|j|t|jdgddgdS(
Nig?iR3R4ii(i(i(R3R=R4tbasisRR5(R.RFRGRH((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRscC`s|jtd	d}|jtd
d}td}|j|d|d|}t|jt|t|j|t|j|t||dtj}tj}tj	|d|d|}t|j
dddS(Nig?iR3R4iii(i(i(i(R3R=R4t	fromrootsRtdegreetlenR
RRDR5(R.RFRGtrR7tpdomtpwinR8((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRs		cC`sd}tjdd}||}|j||d}t|jddgt|||t|jd|jtd
d}|jtdd}|j||dd|d|}t|||t|j|t|j||j||ddddgd|d|}t|||t|j|t|j||j||dg}t|j|jt|j|j|j||ddddgg}t|j|jt|j|jtj	|}|t|j
d}d|ddd<|j|ddd|dddd}|j||dd	|}	|j||ddddgd	|}
t|||	|t|	||
|dS(NcS`s||d|dS(Nii((R?((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pytfsiiig?R3R4iRG(i(i(R1R<tfitR
R3RRKR=R4t
zeros_liketshape(R.RPR?tyRHRFRGtzR7R8tp3((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRs>	!-$/'cC`s|dddgdddgdddg}|dddgdddgdddg}|dddgdddgdddg}|dddgdddgdddg}t||kt||kt||kt||kdS(NiiiR3iR4(R
(R.R7R8RVtp4((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRs----cC`s|dddgdddgdddg}|dddgdddgdddg}|dddgdddgdddg}|dddgdddgdddg}t||kt||kt||kt||kdS(NiiiR3iR4(R
(R.R7R8RVRW((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRs----c	C`sttdd}ttd	d}||}||}||}t|||t|||t|||t|t||tt|||t|tj||ttj|||tttj	||dgd|j
dtttj	||dgd|jd|tkritttj	|t
dgntttj	|tdgdS(
Nig?iiR3iR4(i(i(tlistR=R:ttupleR1tarrayRt	TypeErrortoptaddR3R4RR(R.tc1tc2R7R8RV((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRs"
,,"c	C`sttdd}ttd	d}||}||}||}t|||t|||t|||t|t||tt|||t|tj||ttj|||tttj	||dgd|j
dtttj	||dgd|jd|tkrmtttj	|t
dgntttj	|tdgdS(
Nig?iiR3iR4(i(i(RXR=R:RYR1RZRR[R\tsubR3R4RR(R.R^R_R7R8RV((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRs"
,,"c	C`sttd	d}ttd
d}||}||}||}t|||t|||t|||t|t||tt|||t|tj||ttj|||t|d||dgtd|||dgtttj	||dgd|j
dtttj	||dgd|jd|tkrtttj	|t
dgntttj	|tdgdS(Nig?iiiR3iR4(i(i(RXR=R:RYR1RZRR[R\tmulR3R4RR(R.R^R_R7R8RV((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR
s&
,,"c		C`sttd	d}ttd
d}ttdd}||}||}||}|||}t|j}t|||t|||t|||t|t||tt|||t|tj||ttj|||td||dgt|dd|ttt	j
||dgd|jdttt	j
||dgd|jd|t
krttt	j
|tdgnttt	j
|t
dgdS(Nig?iiiR3iR4(i(i(i(RXR=R5R:RYR1RZRR[R\tfloordivR3R4RR(	R.R^R_tc3R7R8RVRWtc4((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR!s0))"cC`s|dddg}|d}xqtjD]f}t|ts)t|trTq)n|d}ttj|||tt	tj||q)WxRt
ttfD]A}|d}ttj|||tt	tj||qWxOt
gD]D}|dd}ttj|||tt	tj||qWxatttttjdggD]2}tt	tj||tt	tj||qhWx*tD]"}tt	tj||dqWdS(Niiiii(R1t
ScalarTypet
issubclassRtboolR:R\ttruedivRR[tintRtfloattcomplexRYRXtdictRZR(R.R7R8tstypetstptype((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR=s*
4
c		C`sttd	d}ttd
d}ttdd}||}||}||}|||}t|j}t|||t|||t|||t|t||tt|||t|tj||ttj|||td||dgt|d|dgttt	j
||dgd|jdttt	j
||dgd|jd|t
krttt	j
|tdgnttt	j
|t
dgdS(Nig?iiiR3iR4(i(i(i(RXR=R5R:RYR1RZRR[R\tmodR3R4RR(	R.R^R_RcR7R8RVRWRd((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRXs,,,"c	C`sttd	d}ttd
d}ttdd}||}||}||}|||}t|j}t||\}	}
t|	|t|
|t||\}	}
t|	|t|
|t||\}	}
t|	|t|
|t|t|\}	}
t|	|t|
|tt||\}	}
t|	|t|
|t|tj|\}	}
t|	|t|
|ttj||\}	}
t|	|t|
|t|d\}	}
t|	d|t|
|dgtd|\}	}
t|	|dgt|
|dgtt	t||dgd|j
dtt	t||dgd|jd|tkrtt	t|t
dgntt	t|tdgdS(Nig?iiiR3iR4(i(i(i(RXR=R5tdivmodR:RYR1RZRR[R3R4RR(R.R^R_RcR7R8RVRWRdtquotrem((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR ssP













))cC`s|jtdd}|jtdd}tjtd}tj|j|d|d|j}t||tj|j|j}t||dS(	Nig?iR3R4(i(i(i(R3R=R4R1tsortRJtrootsR
(R.RFRGttgttres((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR$s*
cC`s&|jd}t|jddS(Ni(RIRRK(R.RH((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR'scC`s|jd}|j}t||kt||k	t|j|jk	t|j|jk	t|j|jk	dS(Ni(RItcopyR
R5R3R4(R.R7R8((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR(scC`skt}|j|ddd
g}|j|j}|j|jd}t||ddddgt||dddddg|j|dddg}|j|jdd}|j|jddddg}t||ddddgt||dddddg|j|dddg}|j|jdd}|j|jddd}t||ddddgt||d	ddddgd|j}|j|dddgd
|}|j|j}|j|jd}t||ddddgt||dddddgdS(NiiiiitktlbndiiR3iiiiiiiiiiii(RRDtintegR:R3(R.tPtp0R7R8RF((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR"s,"$""
$cC`s>|jtdd}|jtd	d}|dddgd|d|}|jddddg}|jdddg}t|jdj|jt|jdj|j|dddg}|jddddg}|jdddg}t|jdj|jt|jdj|jdS(
Nig?iiR3R4Ry(i(i(R3R=R4R{R
tderivR5(R.RFRGR7R8RV((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR#s!cC`s|jtd	d}|jtd
d}|dddgd|d|}tj|d|dd}||}|jd\}}t||t||tjddd}||}|jddddg\}}t||t||dS(Nig?iiR3R4ii(i(i(R3R=R4R1R<R
(R.RFRGRHtxtgttytgttxrestyres((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR%s!

!
cC`s"|jtd
d}|jtdd}|dgd|d|}|dddgd|d|}x/tdD]!}t|||||}qwW|dg}|dddg}x/tdD]!}t|||||}qWtttj|dtttj|d	dS(Nig?iR3R4iig?i(i(i(	R3R=R4trangeR:Rt
ValueErrorR\tpow(R.RFRGRvttstti((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR!s!cC`s}t}|j}tj|d|dd}|j|dddg}d|dd|}||}t||dS(Niiiii(RR3R1R<RDR
(R.R|RFR?RHRvRw((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyRs	cC`s|dddg}tt|jdtt|jdtt|jddtt|jddtt|jddtt|jdddS(Niiig?ii(RRtcutdegRRL(R.RH((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR)scC`s|dddg}tt|jdtt|jdtt|jddtt|jddtt|jddtt|jdddS(Niiig?ii(RRttruncateRRL(R.RH((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR*$scC`svddddg}||}t|jj|d t|jdj|d t|jdj|d dS(	Nigư>g-q=iig|=igh㈵>(RttrimR5(R.tcRH((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR+.s
cC`s|j}|j}|dgd|d|}tddg|jd|d}|dgd|d|}tddg|jdS(NiR3R4ii(R3R4R
tmapparms(R.RFRGRH((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyR&6s		t__main__(:t__doc__t
__future__RRRtoperatorR\tnumbersRtnumpyR1tnumpy.polynomialRRRRRR	t
numpy.testingR
RRR
Rtnumpy.compatRRR/R=R:RRRRRRRRRRRRRRR R$R'R(R"R#R%R!RR)R*R+R&t__name__(((sV/opt/alt/python27/lib64/python2.7/site-packages/numpy/polynomial/tests/test_classes.pyt<module>sR.(	$			
				,									-