
    wg                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lm	Z	 dd
lm
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd lm Z  dd!lm!Z! dd"lm"Z" dd#lm#Z# dd$lm$Z$ dd%lm%Z% dd&lm&Z& dd'lm'Z' dd(lm(Z( dd)lm)Z) dd*lm*Z* dd+lm+Z+ dd,lm,Z, dd-lm-Z- dd.lm.Z. dd/lm/Z/ dd0lm0Z0 dd1lm1Z1 dd2lm2Z2 dd3lm3Z3 dd4lm4Z4 dd5lm5Z5 dd6lm6Z6 dd7lm7Z7 dd8lm8Z8 dd9lm9Z9 dd:lm:Z: dd;lm;Z; dd<lm<Z< dd=lm=Z= dd>lm>Z> dd?lm?Z? dd@lm@Z@ ddAlmAZA ddBlBmCZC ddClBmDZD ddDlBmEZE ddElBmFZF ddFlBmGZG ddGlBmHZH ddHlBmIZI ddIlBmJZJ ddJlBmKZK ddKlBmLZL ddLlMmNZN ddMlMmOZO ddNlMmPZP ddOlMmQZQ ddPlMmRZR ddQlMmSZS ddRlMmTZT ddSlMmUZU ddTlMmVZV ddUlMmWZW ddVlMmXZX ddWlMmYZY ddXlMmZZZ ddYlMm[Z[ ddZlMm\Z\ dd[lMm]Z] dd\lMm^Z^ dd]lMm_Z_ dd^lMm`Z` dd_lMmaZa dd`lMmbZb ddalMmcZc ddblMmdZd ddclMmeZe dddlMmfZf ddelMmgZg ddflMmhZh ddglMmiZi ddhlMmjZj ddilMmkZk ddjlMmlZl ddklMmmZm ddllMmnZn ddmlMmoZo ddnlMmpZp ddolMmqZq ddplrmsZs ddqlrmtZt ddrlrmuZu ddslrmvZv ddtlrmwZw ddulrmxZx ddvlrmyZy ddwlrmzZz ddxlrm{Z{ ddylrm|Z| ddzlrm}Z} dd{lrm~Z~ dd|lrmZ dd}lrmZ dd~lrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlrmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z mZmZmZmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z  ddӐl!m"Z" e" G dԄ dի             Z#y)z8Compatibility interface between dense and sparse polys.     )dup_add_term)dmp_add_term)dup_sub_term)dmp_sub_term)dup_mul_term)dmp_mul_term)dup_add_ground)dmp_add_ground)dup_sub_ground)dmp_sub_ground)dup_mul_ground)dmp_mul_ground)dup_quo_ground)dmp_quo_ground)dup_exquo_ground)dmp_exquo_ground)
dup_lshift)
dup_rshift)dup_abs)dmp_abs)dup_neg)dmp_neg)dup_add)dmp_add)dup_sub)dmp_sub)dup_add_mul)dmp_add_mul)dup_sub_mul)dmp_sub_mul)dup_mul)dmp_mul)dup_sqr)dmp_sqr)dup_pow)dmp_pow)dup_pdiv)dup_prem)dup_pquo)
dup_pexquo)dmp_pdiv)dmp_prem)dmp_pquo)
dmp_pexquo)
dup_rr_div)
dmp_rr_div)
dup_ff_div)
dmp_ff_div)dup_div)dup_rem)dup_quo)	dup_exquo)dmp_div)dmp_rem)dmp_quo)	dmp_exquo)dup_max_norm)dmp_max_norm)dup_l1_norm)dmp_l1_norm)dup_l2_norm_squared)dmp_l2_norm_squared)
dup_expand)
dmp_expand)dup_LC)dmp_LC)dup_TC)dmp_TC)dmp_ground_LC)dmp_ground_TC)
dup_degree)
dmp_degree)dmp_degree_in)dmp_to_dict)dup_integrate)dmp_integrate)dmp_integrate_in)dup_diff)dmp_diff)dmp_diff_in)dup_eval)dmp_eval)dmp_eval_in)dmp_eval_tail)dmp_diff_eval_in)	dup_trunc)	dmp_trunc)dmp_ground_trunc)	dup_monic)dmp_ground_monic)dup_content)dmp_ground_content)dup_primitive)dmp_ground_primitive)dup_extract)dmp_ground_extract)dup_real_imag)
dup_mirror)	dup_scale)	dup_shift)	dmp_shift)dup_transform)dup_compose)dmp_compose)dup_decompose)dmp_lift)dup_sign_variations)dup_clear_denoms)dmp_clear_denoms)
dup_revert)dup_half_gcdex)dmp_half_gcdex)	dup_gcdex)	dmp_gcdex)
dup_invert)
dmp_invert)dup_euclidean_prs)dmp_euclidean_prs)dup_primitive_prs)dmp_primitive_prs)dup_inner_subresultants)dup_subresultants)dup_prs_resultant)dup_resultant)dmp_inner_subresultants)dmp_subresultants)dmp_prs_resultant)dmp_zz_modular_resultant)dmp_zz_collins_resultant)dmp_qq_collins_resultant)dmp_resultant)dup_discriminant)dmp_discriminant)dup_rr_prs_gcd)dup_ff_prs_gcd)dmp_rr_prs_gcd)dmp_ff_prs_gcd)dup_zz_heu_gcd)dmp_zz_heu_gcd)dup_qq_heu_gcd)dmp_qq_heu_gcd)dup_inner_gcd)dmp_inner_gcd)dup_gcd)dmp_gcd)
dup_rr_lcm)
dup_ff_lcm)dup_lcm)
dmp_rr_lcm)
dmp_ff_lcm)dmp_lcm)dmp_content)dmp_primitive)
dup_cancel)
dmp_cancel)dup_trial_division)dmp_trial_division)dup_zz_mignotte_bound)dmp_zz_mignotte_bound)dup_zz_hensel_step)dup_zz_hensel_lift)dup_zz_zassenhaus)dup_zz_irreducible_p)dup_cyclotomic_p)dup_zz_cyclotomic_poly)dup_zz_cyclotomic_factor)dup_zz_factor_sqf)dup_zz_factor)dmp_zz_wang_non_divisors)dmp_zz_wang_lead_coeffs)dup_zz_diophantine)dmp_zz_diophantine)dmp_zz_wang_hensel_lifting)dmp_zz_wang)dmp_zz_factor)dup_qq_i_factor)dup_zz_i_factor)dmp_qq_i_factor)dmp_zz_i_factor)dup_ext_factor)dmp_ext_factor)dup_gf_factor)dmp_gf_factor)dup_factor_list)dup_factor_list_include)dmp_factor_list)dmp_factor_list_include)dup_irreducible_p)dmp_irreducible_p)	dup_sturm)dup_root_upper_bound)dup_root_lower_bound)dup_step_refine_real_root)dup_inner_refine_real_root)dup_outer_refine_real_root)dup_refine_real_root)dup_inner_isolate_real_roots) dup_inner_isolate_positive_roots) dup_inner_isolate_negative_roots)dup_isolate_real_roots_sqf)dup_isolate_real_roots)dup_isolate_real_roots_list)dup_count_real_roots)dup_count_complex_roots)dup_isolate_complex_roots_sqf)dup_isolate_all_roots_sqf)dup_isolate_all_roots)	dup_sqf_p	dmp_sqf_pdmp_normdup_sqf_normdmp_sqf_normdup_gf_sqf_partdmp_gf_sqf_partdup_sqf_partdmp_sqf_partdup_gf_sqf_listdmp_gf_sqf_listdup_sqf_listdup_sqf_list_includedmp_sqf_listdmp_sqf_list_includedup_gff_listdmp_gff_list)8	gf_degreegf_LCgf_TCgf_stripgf_from_dict
gf_to_dictgf_from_int_polygf_to_int_polygf_neggf_add_groundgf_sub_groundgf_mul_groundgf_quo_groundgf_addgf_subgf_mulgf_sqr
gf_add_mul
gf_sub_mul	gf_expandgf_divgf_remgf_quogf_exquo	gf_lshift	gf_rshiftgf_pow
gf_pow_modgf_gcdgf_lcmgf_cofactorsgf_gcdexgf_monicgf_diffgf_evalgf_multi_eval
gf_composegf_compose_modgf_trace_map	gf_randomgf_irreduciblegf_irred_p_ben_orgf_irred_p_rabingf_irreducible_pgf_sqf_pgf_sqf_part
gf_Qmatrixgf_berlekampgf_ddf_zassenhausgf_edf_zassenhausgf_ddf_shoupgf_edf_shoupgf_zassenhausgf_shoupgf_factor_sqf	gf_factor)publicc                   D   e Zd ZdZdZdZdZdZd Zd*dZ	d Z
d Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d Z%d  Z&d! Z'd" Z(d# Z)d$ Z*d% Z+d& Z,d' Z-d( Z.d) Z/d* Z0d+ Z1d, Z2d- Z3d. Z4d/ Z5d0 Z6d1 Z7d2 Z8d3 Z9d4 Z:d5 Z;d6 Z<d7 Z=d8 Z>d9 Z?d: Z@d; ZAd< ZBd= ZCd> ZDd? ZEd@ ZFdA ZGdB ZHdC ZIdD ZJdE ZKdF ZLdG ZMdH ZNdI ZOdJ ZPdK ZQdL ZRdM ZSdN ZTdO ZUdP ZVdQ ZWdR ZXdS ZYdT ZZdU Z[dV Z\dW Z]dX Z^dY Z_dZ Z`d[ Zad\ Zbd] Zcd^ Zdd_ Zed` Zfda Zgdb Zhdc Zidd Zjde Zkdf Zldg Zmdh Zndi Zodj Zpdk Zqdl Zrdm Zsdn Ztdo Zudp Zvd+dqZwd+drZxds Zydt Zzdu Z{dv Z|dw Z}dx Z~dy Zdz Zd{ Zd| Zd} Zd~ Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd,dZd,dZd Zd Zd Zd Zd Zd Zd Zd Zd+dZd Zd Zd Zd Zd Zd Zd Zd-dZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdÄ ZdĄ Zdń ZdƄ ZdǄ ZdȄ ZdɄ Zdʄ Zd˄ Zd̄ Zd̈́ Zd΄ Zdτ ZdЄ Z֐d+dфZאd+d҄Zؐd+dӄZِd+dԄZڐd+dՄZېd+dքZdׄ Zd؄ Zdل Zdڄ Zd+dۄZd.d܄Zd/d݄Zd/dބZd0d߄Zd.dZd.dZd.dZd.dZd1dZd-dZd*dZd/dZd.dZd/dZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd,dZd Zd,dZd Zd Z d Zd Zd Zd Zd Zd  Zd Zd Zd Z	d Z
d Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d+dZ%d  Z&d! Z'd" Z(d# Z)d$ Z*d% Z+d& Z,d' Z-d2d(Z.d) Z/y(3  IPolysNc                      y N )selfgens     ^/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/polys/compatibility.pydropzIPolys.drop           c                      y r  r   )r!  symbolsdomainorders       r#  clonezIPolys.clone   r%  r&  c                      y r  r   )r!  s    r#  	to_groundzIPolys.to_ground   r%  r&  c                      y r  r   r!  elements     r#  
ground_newzIPolys.ground_new   r%  r&  c                      y r  r   r/  s     r#  
domain_newzIPolys.domain_new   r%  r&  c                      y r  r   )r!  ds     r#  	from_dictzIPolys.from_dict   r%  r&  c                     ddl m} t        ||      r|j                  | k(  r|S t	        d      | j                  |      S )Nr   )PolyElementzdomain conversions)sympy.polys.ringsr8  
isinstanceringNotImplementedErrorr1  )r!  r0  r8  s      r#  wrapzIPolys.wrap  s;    1g{+||t#)*>????7++r&  c                 @    | j                  |      j                         S r  )r=  to_denser/  s     r#  r?  zIPolys.to_dense  s    yy!**,,r&  c                 h    | j                  t        || j                  dz
  | j                              S N   )r6  rL   ngensr)  r/  s     r#  
from_densezIPolys.from_dense  s&    ~~k'4::a<MNNr&  c                 n    | j                  t        | j                  |      ||| j                              S r  )rD  r   r?  r)  r!  fcis       r#  r   zIPolys.dup_add_term  )    |DMM!,<aDKKPQQr&  c           	          | j                  t        | j                  |      | j                  |      j	                  d      j                         || j
                  dz
  | j                              S Nr   rB  )rD  r   r?  r=  r$  rC  r)  rF  s       r#  r   zIPolys.dmp_add_term  Y    |DMM!,<diil>O>OPQ>R>[>[>]_`bfblblmnbnptp{p{|}}r&  c                 n    | j                  t        | j                  |      ||| j                              S r  )rD  r   r?  r)  rF  s       r#  r   zIPolys.dup_sub_term  rJ  r&  c           	          | j                  t        | j                  |      | j                  |      j	                  d      j                         || j
                  dz
  | j                              S rL  )rD  r   r?  r=  r$  rC  r)  rF  s       r#  r   zIPolys.dmp_sub_term  rM  r&  c                 n    | j                  t        | j                  |      ||| j                              S r  )rD  r   r?  r)  rF  s       r#  r   zIPolys.dup_mul_term  rJ  r&  c           	          | j                  t        | j                  |      | j                  |      j	                  d      j                         || j
                  dz
  | j                              S rL  )rD  r   r?  r=  r$  rC  r)  rF  s       r#  r   zIPolys.dmp_mul_term  rM  r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r	   r?  r)  r!  rG  rH  s      r#  r	   zIPolys.dup_add_ground  '    ~dmmA.>4;;OPPr&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  r
   r?  rC  r)  rS  s      r#  r
   zIPolys.dmp_add_ground   4    ~dmmA.>4::a<QUQ\Q\]^^r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r   r?  r)  rS  s      r#  r   zIPolys.dup_sub_ground"  rT  r&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rS  s      r#  r   zIPolys.dmp_sub_ground$  rV  r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r   r?  r)  rS  s      r#  r   zIPolys.dup_mul_ground&  rT  r&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rS  s      r#  r   zIPolys.dmp_mul_ground(  rV  r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r   r?  r)  rS  s      r#  r   zIPolys.dup_quo_ground*  rT  r&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rS  s      r#  r   zIPolys.dmp_quo_ground,  rV  r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r   r?  r)  rS  s      r#  r   zIPolys.dup_exquo_ground.  s(    /a0@!T[[QRRr&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rS  s      r#  r   zIPolys.dmp_exquo_ground0  6    /a0@!TZZPQ\SWS^S^_``r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r   r?  r)  r!  rG  ns      r#  r   zIPolys.dup_lshift3  '    z$--*:At{{KLLr&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r   r?  r)  ra  s      r#  r   zIPolys.dup_rshift5  rc  r&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  r   r?  r)  r!  rG  s     r#  r   zIPolys.dup_abs8  %    wt}}Q'7EFFr&  c                     | j                  t        | j                  |      | j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rf  s     r#  r   zIPolys.dmp_abs:  /    wt}}Q'7At{{STTr&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  r   r?  r)  rf  s     r#  r   zIPolys.dup_neg=  rg  r&  c                     | j                  t        | j                  |      | j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rf  s     r#  r   zIPolys.dmp_neg?  ri  r&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r   r?  r)  r!  rG  gs      r#  r   zIPolys.dup_addB  0    wt}}Q'7q9I4;;WXXr&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rm  s      r#  r   zIPolys.dmp_addD  >    wt}}Q'7q9I4::VW<Y]YdYdeffr&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r   r?  r)  rm  s      r#  r   zIPolys.dup_subG  ro  r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rm  s      r#  r   zIPolys.dmp_subI  rq  r&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                              S r  )rD  r   r?  r)  r!  rG  rn  hs       r#  r   zIPolys.dup_add_mulL  ?    {4==+;T]]1=Mt}}]^O_aealalmnnr&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  ru  s       r#  r   zIPolys.dmp_add_mulN  N    {4==+;T]]1=Mt}}]^O_aeakaklmamosozoz{||r&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                              S r  )rD  r   r?  r)  ru  s       r#  r   zIPolys.dup_sub_mulP  rw  r&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r    r?  rC  r)  ru  s       r#  r    zIPolys.dmp_sub_mulR  ry  r&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r!   r?  r)  rm  s      r#  r!   zIPolys.dup_mulU  ro  r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r"   r?  rC  r)  rm  s      r#  r"   zIPolys.dmp_mulW  rq  r&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  r#   r?  r)  rf  s     r#  r#   zIPolys.dup_sqrZ  rg  r&  c                     | j                  t        | j                  |      | j                  dz
  | j                              S rA  )rD  r$   r?  rC  r)  rf  s     r#  r$   zIPolys.dmp_sqr\  ri  r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  r%   r?  r)  ra  s      r#  r%   zIPolys.dup_pow^  s'    wt}}Q'7DKKHIIr&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  r&   r?  rC  r)  ra  s      r#  r&   zIPolys.dmp_pow`  s1    wt}}Q'7DJJqL$++VWWr&  c                     t        | j                  |      | j                  |      | j                        \  }}| j                  |      | j                  |      fS r  )r'   r?  r)  rD  r!  rG  rn  qrs        r#  r'   zIPolys.dup_pdivc  sG    a($--*:DKKH1"DOOA$677r&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r(   r?  r)  rm  s      r#  r(   zIPolys.dup_premf  0    xa(8$--:JDKKXYYr&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r)   r?  r)  rm  s      r#  r)   zIPolys.dup_pquoh  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r*   r?  r)  rm  s      r#  r*   zIPolys.dup_pexquoj  0    z$--*:DMM!<LdkkZ[[r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}| j	                  |      | j	                  |      fS rA  )r+   r?  rC  r)  rD  r  s        r#  r+   zIPolys.dmp_pdivm  sQ    a($--*:DJJqL$++V1"DOOA$677r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r,   r?  rC  r)  rm  s      r#  r,   zIPolys.dmp_premp  >    xa(8$--:JDJJWXLZ^ZeZefggr&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r-   r?  rC  r)  rm  s      r#  r-   zIPolys.dmp_pquor  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r.   r?  rC  r)  rm  s      r#  r.   zIPolys.dmp_pexquot  >    z$--*:DMM!<LdjjYZl\`\g\ghiir&  c                     t        | j                  |      | j                  |      | j                        \  }}| j                  |      | j                  |      fS r  )r/   r?  r)  rD  r  s        r#  r/   zIPolys.dup_rr_divw  G    $--*DMM!,<dkkJ1"DOOA$677r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}| j	                  |      | j	                  |      fS rA  )r0   r?  rC  r)  rD  r  s        r#  r0   zIPolys.dmp_rr_divz  Q    $--*DMM!,<djjlDKKX1"DOOA$677r&  c                     t        | j                  |      | j                  |      | j                        \  }}| j                  |      | j                  |      fS r  )r1   r?  r)  rD  r  s        r#  r1   zIPolys.dup_ff_div}  r  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}| j	                  |      | j	                  |      fS rA  )r2   r?  rC  r)  rD  r  s        r#  r2   zIPolys.dmp_ff_div  r  r&  c                     t        | j                  |      | j                  |      | j                        \  }}| j                  |      | j                  |      fS r  )r3   r?  r)  rD  r  s        r#  r3   zIPolys.dup_div  sG    t}}Q'q)94;;G1"DOOA$677r&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r4   r?  r)  rm  s      r#  r4   zIPolys.dup_rem  ro  r&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r5   r?  r)  rm  s      r#  r5   zIPolys.dup_quo  ro  r&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  r6   r?  r)  rm  s      r#  r6   zIPolys.dup_exquo  s0    yq)94==;KT[[YZZr&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}| j	                  |      | j	                  |      fS rA  )r7   r?  rC  r)  rD  r  s        r#  r7   zIPolys.dmp_div  sQ    t}}Q'q)94::a<U1"DOOA$677r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r8   r?  rC  r)  rm  s      r#  r8   zIPolys.dmp_rem  rq  r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r9   r?  rC  r)  rm  s      r#  r9   zIPolys.dmp_quo  rq  r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  r:   r?  rC  r)  rm  s      r#  r:   zIPolys.dmp_exquo  s>    yq)94==;KTZZXY\[_[f[fghhr&  c                 L    t        | j                  |      | j                        S r  )r;   r?  r)  rf  s     r#  r;   zIPolys.dup_max_norm  s    DMM!,dkk::r&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )r<   r?  rC  r)  rf  s     r#  r<   zIPolys.dmp_max_norm  s&    DMM!,djjlDKKHHr&  c                 L    t        | j                  |      | j                        S r  )r=   r?  r)  rf  s     r#  r=   zIPolys.dup_l1_norm  s    4==+T[[99r&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )r>   r?  rC  r)  rf  s     r#  r>   zIPolys.dmp_l1_norm  s&    4==+TZZ\4;;GGr&  c                 L    t        | j                  |      | j                        S r  )r?   r?  r)  rf  s     r#  r?   zIPolys.dup_l2_norm_squared      "4==#3T[[AAr&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )r@   r?  rC  r)  rf  s     r#  r@   zIPolys.dmp_l2_norm_squared  s&    "4==#3TZZ\4;;OOr&  c           
          | j                  t        t        t        | j                  |            | j
                              S r  )rD  rA   listmapr?  r)  r!  polyss     r#  rA   zIPolys.dup_expand  s,    z$s4==%/H*I4;;WXXr&  c           
          | j                  t        t        t        | j                  |            | j
                  dz
  | j                              S rA  )rD  rB   r  r  r?  rC  r)  r  s     r#  rB   zIPolys.dmp_expand  s:    z$s4==%/H*I4::VW<Y]YdYdeffr&  c                 L    t        | j                  |      | j                        S r  )rC   r?  r)  rf  s     r#  rC   zIPolys.dup_LC      dmmA&44r&  c                     t        | j                  |      | j                        }t        |t              r| dd  j                  |      S |S rA  )rD   r?  r)  r:  r  rD  )r!  rG  LCs      r#  rD   zIPolys.dmp_LC  A    DMM!$dkk2b$8&&r**Ir&  c                 L    t        | j                  |      | j                        S r  )rE   r?  r)  rf  s     r#  rE   zIPolys.dup_TC  r  r&  c                     t        | j                  |      | j                        }t        |t              r| dd  j                  |      S |S rA  )rF   r?  r)  r:  r  rD  )r!  rG  TCs      r#  rF   zIPolys.dmp_TC  r  r&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )rG   r?  rC  r)  rf  s     r#  rG   zIPolys.dmp_ground_LC  &    T]]1-tzz!|T[[IIr&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )rH   r?  rC  r)  rf  s     r#  rH   zIPolys.dmp_ground_TC  r  r&  c                 6    t        | j                  |            S r  )rI   r?  rf  s     r#  rI   zIPolys.dup_degree  s    $--*++r&  c                 R    t        | j                  |      | j                  dz
        S rA  )rJ   r?  rC  rf  s     r#  rJ   zIPolys.dmp_degree  s     $--*DJJqL99r&  c                 T    t        | j                  |      || j                  dz
        S rA  )rK   r?  rC  )r!  rG  js      r#  rK   zIPolys.dmp_degree_in  s"    T]]1-q$**Q,??r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  rM   r?  r)  r!  rG  ms      r#  rM   zIPolys.dup_integrate  s'    }T]]1-=q$++NOOr&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  rN   r?  rC  r)  r  s      r#  rN   zIPolys.dmp_integrate  s4    }T]]1-=q$**Q,PTP[P[\]]r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  rP   r?  r)  r  s      r#  rP   zIPolys.dup_diff  s'    xa(8!T[[IJJr&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  rQ   r?  rC  r)  r  s      r#  rQ   zIPolys.dmp_diff  s1    xa(8!TZZ\4;;WXXr&  c           	          | j                  t        | j                  |      ||| j                  dz
  | j                              S rA  )rD  rR   r?  rC  r)  r!  rG  r  r  s       r#  rR   zIPolys.dmp_diff_in  s6    {4==+;Q4::a<QUQ\Q\]^^r&  c           	          | j                  t        | j                  |      ||| j                  dz
  | j                              S rA  )rD  rO   r?  rC  r)  r  s       r#  rO   zIPolys.dmp_integrate_in  s8    /a0@!Q

STVZVaVabccr&  c                 N    t        | j                  |      || j                        S r  )rS   r?  r)  r!  rG  as      r#  rS   zIPolys.dup_eval  s    a(!T[[99r&  c                     t        | j                  |      || j                  dz
  | j                        }| dd  j	                  |      S rA  )rT   r?  rC  r)  rD  )r!  rG  r  results       r#  rT   zIPolys.dmp_eval  s>    $--*Atzz!|T[[IABx""6**r&  c                     t        | j                  |      ||| j                  dz
  | j                        }| j	                  |      j                  |      S rA  )rU   r?  rC  r)  r$  rD  )r!  rG  r  r  r  s        r#  rU   zIPolys.dmp_eval_in  sB    T]]1-q!TZZ\4;;Oyy|&&v..r&  c                     t        | j                  |      |||| j                  dz
  | j                        }| j	                  |      j                  |      S rA  )rW   r?  rC  r)  r$  rD  )r!  rG  r  r  r  r  s         r#  rW   zIPolys.dmp_diff_eval_in  sD    !$--"2Aq!TZZ\4;;Wyy|&&v..r&  c                     t        | j                  |      || j                  dz
  | j                        }t	        |t
              r| d t        |        j                  |      S |S rA  )rV   r?  rC  r)  r:  r  lenrD  )r!  rG  Ar  s       r#  rV   zIPolys.dmp_eval_tail  sS    t}}Q/DJJqL$++Nfd##a&>,,V44Mr&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  rX   r?  r)  r!  rG  ps      r#  rX   zIPolys.dup_trunc  '    yq)91dkkJKKr&  c                     | j                  t        | j                  |      | dd  j                  |      | j                  dz
  | j                              S rA  )rD  rY   r?  rC  r)  rm  s      r#  rY   zIPolys.dmp_trunc  sJ    yq)948;L;LQ;OQUQ[Q[\]Q]_c_j_jkllr&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  rZ   r?  rC  r)  r  s      r#  rZ   zIPolys.dmp_ground_trunc  r_  r&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  r[   r?  r)  rf  s     r#  r[   zIPolys.dup_monic  s%    yq)94;;GHHr&  c                     | j                  t        | j                  |      | j                  dz
  | j                              S rA  )rD  r\   r?  rC  r)  rf  s     r#  r\   zIPolys.dmp_ground_monic  s3    /a0@$**Q,PTP[P[\]]r&  c                     t        | j                  |      | j                  |      | j                        \  }}}|| j                  |      | j                  |      fS r  )ra   r?  r)  rD  r!  rG  rn  rH  FGs         r#  ra   zIPolys.dup_extract  sK    dmmA.a0@$++N1a4??1%tq'9::r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}}|| j	                  |      | j	                  |      fS rA  )rb   r?  rC  r)  rD  r  s         r#  rb   zIPolys.dmp_ground_extract  sY    $T]]1%5t}}Q7GTUW[WbWbc1a4??1%tq'9::r&  c                     t        | j                  |      j                  d      j                         | j                        \  }}| j                  |      | j                  |      fS rA  )rc   r=  r$  r?  r)  rD  r!  rG  r  r  s       r#  rc   zIPolys.dup_real_imag  sO    TYYq\..q1::<dkkJ1"DOOA$677r&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  rd   r?  r)  rf  s     r#  rd   zIPolys.dup_mirror  s%    z$--*:DKKHIIr&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  re   r?  r)  r  s      r#  re   zIPolys.dup_scale  r  r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  rf   r?  r)  r  s      r#  rf   zIPolys.dup_shift  r  r&  c                     | j                  t        | j                  |      || j                  dz
  | j                              S rA  )rD  rg   r?  rC  r)  r  s      r#  rg   zIPolys.dmp_shift  s1    yq)91djjlDKKXYYr&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                              S r  )rD  rh   r?  r)  r  s       r#  rh   zIPolys.dup_transform
  sB    }T]]1-=t}}Q?OQUQ^Q^_`Qacgcncnoppr&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  ri   r?  r)  rm  s      r#  ri   zIPolys.dup_compose  s0    {4==+;T]]1=Mt{{[\\r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  rj   r?  rC  r)  rm  s      r#  rj   zIPolys.dmp_compose  s>    {4==+;T]]1=MtzzZ[|]a]h]hijjr&  c                     t        | j                  |      | j                        }t        t	        | j
                  |            S r  )rk   r?  r)  r  r  rD  )r!  rG  
componentss      r#  rk   zIPolys.dup_decompose  s1    "4==#3T[[A
C455r&  c                     t        | j                  |      | j                  dz
  | j                        }| j	                         j                  |      S rA  )rl   r?  rC  r)  r-  rD  r!  rG  r  s      r#  rl   zIPolys.dmp_lift  s=    $--*DJJqL$++F~~**622r&  c                 L    t        | j                  |      | j                        S r  )rm   r?  r)  rf  s     r#  rm   zIPolys.dup_sign_variations  r  r&  c                     t        | j                  |      | j                  |      \  }}|r+| j                  | j                  j	                               }n| }||j                  |      fS )Nconvertr)  )rn   r?  r)  r+  get_ringrD  r!  rG  r  rH  r  r;  s         r#  rn   zIPolys.dup_clear_denoms  sZ    a 0$++wO1::T[[%9%9%;:<DD4??1%&&r&  c                     t        | j                  |      | j                  dz
  | j                  |      \  }}|r+| j	                  | j                  j                               }n| }||j                  |      fS )NrB  r  r  )ro   r?  rC  r)  r+  r  rD  r  s         r#  ro   zIPolys.dmp_clear_denoms$  se    a 0$**Q,U\]1::T[[%9%9%;:<DD4??1%&&r&  c                 l    | j                  t        | j                  |      || j                              S r  )rD  rp   r?  r)  ra  s      r#  rp   zIPolys.dup_revert,  rc  r&  c                     t        | j                  |      | j                  |      | j                        \  }}| j                  |      | j                  |      fS r  )rq   r?  r)  rD  r!  rG  rn  srv  s        r#  rq   zIPolys.dup_half_gcdex/  sG    dmmA.a0@$++N1"DOOA$677r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}| j	                  |      | j	                  |      fS rA  )rr   r?  rC  r)  rD  r  s        r#  rr   zIPolys.dmp_half_gcdex2  sT    dmmA.a0@$**Q,PTP[P[\1"DOOA$677r&  c                     t        | j                  |      | j                  |      | j                        \  }}}| j                  |      | j                  |      | j                  |      fS r  )rs   r?  r)  rD  r!  rG  rn  r  trv  s         r#  rs   zIPolys.dup_gcdex5  sT    DMM!,dmmA.>L1a"DOOA$68JKKr&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}}| j	                  |      | j	                  |      | j	                  |      fS rA  )rt   r?  rC  r)  rD  r  s         r#  rt   zIPolys.dmp_gcdex8  s^    DMM!,dmmA.>

1dkkZ1a"DOOA$68JKKr&  c                     | j                  t        | j                  |      | j                  |      | j                              S r  )rD  ru   r?  r)  rm  s      r#  ru   zIPolys.dup_invert<  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  dz
  | j                              S rA  )rD  rv   r?  rC  r)  rm  s      r#  rv   zIPolys.dmp_invert>  r  r&  c                     t        | j                  |      | j                  |      | j                        }t        t	        | j
                  |            S r  )rw   r?  r)  r  r  rD  r!  rG  rn  prss       r#  rw   zIPolys.dup_euclidean_prsA  <    a 0$--2BDKKPC-..r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }t	        t        | j                  |            S rA  )rx   r?  rC  r)  r  r  rD  r  s       r#  rx   zIPolys.dmp_euclidean_prsD  I    a 0$--2BDJJqLRVR]R]^C-..r&  c                     t        | j                  |      | j                  |      | j                        }t        t	        | j
                  |            S r  )ry   r?  r)  r  r  rD  r  s       r#  ry   zIPolys.dup_primitive_prsG  r  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }t	        t        | j                  |            S rA  )rz   r?  rC  r)  r  r  rD  r  s       r#  rz   zIPolys.dmp_primitive_prsJ  r   r&  c                     t        | j                  |      | j                  |      | j                        \  }}t        t	        | j
                  |            |fS r  )r{   r?  r)  r  r  rD  r!  rG  rn  r  sress        r#  r{   zIPolys.dup_inner_subresultantsN  sH    +DMM!,<dmmA>NPTP[P[\	TS#./66r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}t	        t        | j                  |            |fS rA  )r   r?  rC  r)  r  r  rD  r  s        r#  r   zIPolys.dmp_inner_subresultantsQ  sW    ,T]]1-=t}}Q?OQUQ[Q[\]Q]_c_j_jk	TS#./66r&  c                     t        | j                  |      | j                  |      | j                        }t        t	        | j
                  |            S r  )r|   r?  r)  r  r  rD  r  s       r#  r|   zIPolys.dup_subresultantsU  r  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }t	        t        | j                  |            S rA  )r   r?  rC  r)  r  r  rD  r  s       r#  r   zIPolys.dmp_subresultantsX  r   r&  c                     t        | j                  |      | j                  |      | j                        \  }}|t        t	        | j
                  |            fS r  )r}   r?  r)  r  r  rD  r!  rG  rn  resr  s        r#  r}   zIPolys.dup_prs_resultant\  sE    $T]]1%5t}}Q7GUST#doos3455r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}| dd  j	                  |      t        t        | j                  |            fS rA  )r   r?  rC  r)  rD  r  r  r
  s        r#  r   zIPolys.dmp_prs_resultant_  sd    $T]]1%5t}}Q7GTUW[WbWbcSQR##C($s4??C/H*IJJr&  c                     t        | j                  |      | j                  |      | j                  |      | j                  dz
  | j                        }| dd  j                  |      S rA  )r   r?  r3  rC  r)  rD  )r!  rG  rn  r  r  s        r#  r   zIPolys.dmp_zz_modular_resultantc  s[    &t}}Q'7q9I4??[\K]_c_i_ijk_kmqmxmxyABx""3''r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }| dd  j	                  |      S rA  )r   r?  rC  r)  rD  r!  rG  rn  r  s       r#  r   zIPolys.dmp_zz_collins_resultantf  K    &t}}Q'7q9I4::VW<Y]YdYdeABx""3''r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }| dd  j	                  |      S rA  )r   r?  rC  r)  rD  r  s       r#  r   zIPolys.dmp_qq_collins_resultanti  r  r&  c                 l    t        | j                  |      | j                  |      | j                        S r  )r~   r?  r)  rm  s      r#  r~   zIPolys.dup_resultantm  s'    T]]1-t}}Q/?MMr&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }t	        |t
              r| dd  j                  |      S |S rA  )r   r?  rC  r)  r:  r  rD  r  s       r#  r   zIPolys.dmp_resultanto  sV    DMM!,dmmA.>

1dkkZc4 8&&s++Jr&  c                 L    t        | j                  |      | j                        S r  )r   r?  r)  rf  s     r#  r   zIPolys.dup_discriminantv  s    a 0$++>>r&  c                     t        | j                  |      | j                  dz
  | j                        }t	        |t
              r| dd  j                  |      S |S rA  )r   r?  rC  r)  r:  r  rD  )r!  rG  discs      r#  r   zIPolys.dmp_discriminantx  sK    a 0$**Q,LdD!8&&t,,Kr&  c                     t        | j                  |      | j                  |      | j                        \  }}}| j                  |      | j                  |      | j                  |      fS r  )r   r?  r)  rD  r!  rG  rn  Hr  r  s         r#  r   zIPolys.dup_rr_prs_gcd  T     q!14==3CT[[Q1a"DOOA$68JKKr&  c                     t        | j                  |      | j                  |      | j                        \  }}}| j                  |      | j                  |      | j                  |      fS r  )r   r?  r)  rD  r  s         r#  r   zIPolys.dup_ff_prs_gcd  r  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}}| j	                  |      | j	                  |      | j	                  |      fS rA  )r   r?  rC  r)  rD  r  s         r#  r   zIPolys.dmp_rr_prs_gcd  b     q!14==3CTZZPQ\SWS^S^_1a"DOOA$68JKKr&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}}| j	                  |      | j	                  |      | j	                  |      fS rA  )r   r?  rC  r)  rD  r  s         r#  r   zIPolys.dmp_ff_prs_gcd  r  r&  c                     t        | j                  |      | j                  |      | j                        \  }}}| j                  |      | j                  |      | j                  |      fS r  )r   r?  r)  rD  r  s         r#  r   zIPolys.dup_zz_heu_gcd  r  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}}| j	                  |      | j	                  |      | j	                  |      fS rA  )r   r?  rC  r)  rD  r  s         r#  r   zIPolys.dmp_zz_heu_gcd  r  r&  c                     t        | j                  |      | j                  |      | j                        \  }}}| j                  |      | j                  |      | j                  |      fS r  )r   r?  r)  rD  r  s         r#  r   zIPolys.dup_qq_heu_gcd  r  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}}| j	                  |      | j	                  |      | j	                  |      fS rA  )r   r?  rC  r)  rD  r  s         r#  r   zIPolys.dmp_qq_heu_gcd  r  r&  c                     t        | j                  |      | j                  |      | j                        \  }}}| j                  |      | j                  |      | j                  |      fS r  )r   r?  r)  rD  r  s         r#  r   zIPolys.dup_inner_gcd  sT    a 0$--2BDKKP1a"DOOA$68JKKr&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        \  }}}| j	                  |      | j	                  |      | j	                  |      fS rA  )r   r?  rC  r)  rD  r  s         r#  r   zIPolys.dmp_inner_gcd  sa    a 0$--2BDJJqLRVR]R]^1a"DOOA$68JKKr&  c                     t        | j                  |      | j                  |      | j                        }| j                  |      S r  )r   r?  r)  rD  r!  rG  rn  r  s       r#  r   zIPolys.dup_gcd  5    DMM!$dmmA&6Dq!!r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }| j	                  |      S rA  )r   r?  rC  r)  rD  r&  s       r#  r   zIPolys.dmp_gcd  ?    DMM!$dmmA&6

1dkkRq!!r&  c                     t        | j                  |      | j                  |      | j                        }| j                  |      S r  )r   r?  r)  rD  r&  s       r#  r   zIPolys.dup_rr_lcm  5    t}}Q'q)94;;Gq!!r&  c                     t        | j                  |      | j                  |      | j                        }| j                  |      S r  )r   r?  r)  rD  r&  s       r#  r   zIPolys.dup_ff_lcm  r+  r&  c                     t        | j                  |      | j                  |      | j                        }| j                  |      S r  )r   r?  r)  rD  r&  s       r#  r   zIPolys.dup_lcm  r'  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }| j	                  |      S rA  )r   r?  rC  r)  rD  r&  s       r#  r   zIPolys.dmp_rr_lcm  ?    t}}Q'q)94::a<Uq!!r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }| j	                  |      S rA  )r   r?  rC  r)  rD  r&  s       r#  r   zIPolys.dmp_ff_lcm  r/  r&  c                     t        | j                  |      | j                  |      | j                  dz
  | j                        }| j	                  |      S rA  )r   r?  rC  r)  rD  r&  s       r#  r   zIPolys.dmp_lcm  r)  r&  c                 P    t        | j                  |      | j                        }|S r  )r]   r?  r)  r!  rG  conts      r#  r]   zIPolys.dup_content  s     4==+T[[9r&  c                 x    t        | j                  |      | j                        \  }}|| j                  |      fS r  )r_   r?  r)  rD  r!  rG  r4  prims       r#  r_   zIPolys.dup_primitive  s3    "4==#3T[[A
dT__T***r&  c                     t        | j                  |      | j                  dz
  | j                        }t	        |t
              r| dd  j                  |      S |S rA  )r   r?  rC  r)  r:  r  rD  r3  s      r#  r   zIPolys.dmp_content  sK    4==+TZZ\4;;GdD!8&&t,,Kr&  c                     t        | j                  |      | j                  dz
  | j                        \  }}t	        |t
              r%| dd  j                  |      | j                  |      fS || j                  |      fS rA  )r   r?  rC  r)  r:  r  rD  r6  s       r#  r   zIPolys.dmp_primitive  sl    "4==#3TZZ\4;;O
ddD!H''-tt/DEE$//$/00r&  c                 l    t        | j                  |      | j                  dz
  | j                        }|S rA  )r^   r?  rC  r)  r3  s      r#  r^   zIPolys.dmp_ground_content  s*    !$--"2DJJqL$++Nr&  c                     t        | j                  |      | j                  dz
  | j                        \  }}|| j	                  |      fS rA  )r`   r?  rC  r)  rD  r6  s       r#  r`   zIPolys.dmp_ground_primitive  s=    )$--*:DJJqL$++V
ddood+,,r&  c                    t        | j                  |      | j                  |      | j                  |      }|s+|\  }}}}||| j                  |      | j                  |      fS |\  }}| j                  |      | j                  |      fS )Ninclude)r   r?  r)  rD  	r!  rG  rn  r>  r  cfcgr  r  s	            r#  r   zIPolys.dup_cancel  s    DMM!,dmmA.>U\]!LBAqDOOA.0BCCDAqOOA&(:;;r&  c                 4   t        | j                  |      | j                  |      | j                  dz
  | j                  |      }|s+|\  }}}}||| j	                  |      | j	                  |      fS |\  }}| j	                  |      | j	                  |      fS )NrB  r=  )r   r?  rC  r)  rD  r?  s	            r#  r   zIPolys.dmp_cancel  s    DMM!,dmmA.>

1dkkcjk!LBAqDOOA.0BCCDAqOOA&(:;;r&  c           	          t        | j                  |      t        t        | j                  |            | j                        }|D cg c]  \  }}| j                  |      |f c}}S c c}}w r  )r   r?  r  r  r)  rD  r!  rG  factorsrn  ks        r#  r   zIPolys.dup_trial_division  sV    $T]]1%5tCw<W7XZ^ZeZef5<>TQ$//!$a(>>>s   	A*c           	          t        | j                  |      t        t        | j                  |            | j                  dz
  | j
                        }|D cg c]  \  }}| j                  |      |f c}}S c c}}w rA  )r   r?  r  r  rC  r)  rD  rD  s        r#  r   zIPolys.dmp_trial_division  se    $T]]1%5tCw<W7XZ^ZdZdefZfhlhshst5<>TQ$//!$a(>>>s   A8c                 L    t        | j                  |      | j                        S r  )r   r?  r)  rf  s     r#  r   zIPolys.dup_zz_mignotte_bound  s    $T]]1%5t{{CCr&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )r   r?  rC  r)  rf  s     r#  r   zIPolys.dmp_zz_mignotte_bound  s&    $T]]1%5tzz!|T[[QQr&  c           
         | j                   }t        | ||       ||       ||       ||       ||      | j                        \  }}	}
}| j                  |      | j                  |	      | j                  |
      | j                  |      fS r  )r?  r   r)  rD  )r!  r  rG  rn  rv  r  r  Dr  r  STs               r#  r   zIPolys.dup_zz_hensel_step  su    MM'1Q41qtQqT1Q4U
1a"DOOA$68JDOO\]L^__r&  c           
          | j                   }t        | ||      t        t        ||            || j                        }t        t        | j
                  |            S r  )r?  r   r  r  r)  rD  )r!  r  rG  f_listlrK  r  s          r#  r   zIPolys.dup_zz_hensel_lift  sF    MM"1adDQ,@!T[[QC/00r&  c                     t        | j                  |      | j                        }|D cg c]  \  }}| j                  |      |f c}}S c c}}w r  )r   r?  r)  rD  rD  s        r#  r   zIPolys.dup_zz_zassenhaus  sA    #DMM!$4dkkB5<>TQ$//!$a(>>>   Ac                 L    t        | j                  |      | j                        S r  )r   r?  r)  rf  s     r#  r   zIPolys.dup_zz_irreducible_p      #DMM!$4dkkBBr&  c                 P    t        | j                  |      | j                  |      S )N)irreducible)r   r?  r)  )r!  rG  rV  s      r#  r   zIPolys.dup_cyclotomic_p  s    a 0$++;WWr&  c                 P    t        || j                        }| j                  |      S r  )r   r)  rD  )r!  rb  r  s      r#  r   zIPolys.dup_zz_cyclotomic_poly  s!    "1dkk2q!!r&  c                     t        | j                  |      | j                        }||S t        t	        | j
                  |            S r  )r   r?  r)  r  r  rD  r  s      r#  r   zIPolys.dup_zz_cyclotomic_factor  s;    )$--*:DKKH>MDOOV455r&  c                 2    t        |||| j                        S r  )r   r)  )r!  Ecscts       r#  r   zIPolys.dmp_zz_wang_non_divisors
  s    '2r4;;??r&  c           
         | dd  }|D 	cg c]  \  }}	|j                  |      |	f }}}	| d d }
t        t        |
j                   |            }t        | j                  |      |||||| j                  dz
  | j
                        \  }}}| j                  |      t        t        |
j                  |            t        t        |j                  |            fS c c}	}w rA  )r?  r  r  r   rC  r)  rD  )r!  rG  rM  r[  rZ  r  r  mvr  rF  uvHHCCs                r#  r   zIPolys.dmp_zz_wang_lead_coeffs  s    !"X./1dar{{1~q!11"1XR[[!$%+DMM!,<aQ1djjYZl\`\g\gh	2rq!4BMM2(>#?c"--Y[F\A]]]	 2s   Cc                     t        t        t        | j                  |            ||| j                        }t        t        | j
                  |            S r  )r   r  r  r?  r)  rD  )r!  r  r  r  r  s        r#  r   zIPolys.dup_zz_diophantine  s<    #DT]]A)>$?At{{SC011r&  c           	          t        t        t        | j                  |            | j                  |      |||| j                  dz
  | j
                        }t        t        | j                  |            S rA  )r   r  r  r?  rC  r)  rD  )r!  r  rH  r  r5  r  r  s          r#  r   zIPolys.dmp_zz_diophantine   s^    #DT]]A)>$?qAQSTVWYZ\`\f\fgh\hjnjujuvC011r&  c           	      >   | d d }| dd  }t        t        |j                  |            }t        t        |j                  |            }t        | j                  |      ||||| j                  dz
  | j
                        }t        t        | j                  |            S rA  )r  r  r?  r   rC  r)  rD  )	r!  rG  r  r  r  r  r_  r^  r  s	            r#  r   z!IPolys.dmp_zz_wang_hensel_lifting%  s    "1X!"XR[[!$%#bkk2&'+DMM!,<aQ4::VW<Y]YdYdeC011r&  c                     t        | j                  |      | j                  dz
  | j                  ||      }|D cg c]  }| j	                  |       c}S c c}w )NrB  )modseed)r   r?  rC  r)  rD  )r!  rG  rf  rg  rE  rn  s         r#  r   zIPolys.dmp_zz_wang-  sG    dmmA.

1dkksY]^-46#666s   Ac                     t        | j                  |      | j                        \  }}||D cg c]  }| j                  |       c}fS c c}w r  )r   r?  r)  rD  )r!  rG  coeffrE  rn  s        r#  r   zIPolys.dup_zz_factor_sqf1  sA    *4==+;T[[IwW>+>??>s   A
c                     t        | j                  |      | j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r   r?  r)  rD  r!  rG  ri  rE  rn  rF  s         r#  r   zIPolys.dup_zz_factor5  J    &t}}Q'7EwWFTQ$//!,a0FGGF   Ac                     t        | j                  |      | j                  dz
  | j                        \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w rA  )r   r?  rC  r)  rD  rk  s         r#  r   zIPolys.dmp_zz_factor8  T    &t}}Q'7At{{SwWFTQ$//!,a0FGGF   Ac                     t        | j                  |      | j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r   r?  r)  rD  rk  s         r#  r   zIPolys.dup_qq_i_factor<  J    (q)94;;GwWFTQ$//!,a0FGGFrm  c                     t        | j                  |      | j                  dz
  | j                        \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w rA  )r   r?  rC  r)  rD  rk  s         r#  r   zIPolys.dmp_qq_i_factor?  T    (q)94::a<UwWFTQ$//!,a0FGGFrp  c                     t        | j                  |      | j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r   r?  r)  rD  rk  s         r#  r   zIPolys.dup_zz_i_factorC  rr  rm  c                     t        | j                  |      | j                  dz
  | j                        \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w rA  )r   r?  rC  r)  rD  rk  s         r#  r   zIPolys.dmp_zz_i_factorF  rt  rp  c                     t        | j                  |      | j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r   r?  r)  rD  rk  s         r#  r   zIPolys.dup_ext_factorJ  sJ    'a(8$++FwWFTQ$//!,a0FGGFrm  c                     t        | j                  |      | j                  dz
  | j                        \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w rA  )r   r?  rC  r)  rD  rk  s         r#  r   zIPolys.dmp_ext_factorM  sT    'a(8$**Q,TwWFTQ$//!,a0FGGFrp  c                     t        | j                  |      | j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r   r?  r)  rD  rk  s         r#  r   zIPolys.dup_gf_factorQ  rl  rm  c                     t        | j                  |      | j                  dz
  | j                        \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w rA  )r   r?  rC  r)  rD  rk  s         r#  r   zIPolys.dmp_gf_factorT  ro  rp  c                     t        | j                  |      | j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r   r?  r)  rD  rk  s         r#  r   zIPolys.dup_factor_listX  rr  rm  c                     t        | j                  |      | j                        }|D cg c]  \  }}| j                  |      |f c}}S c c}}w r  )r   r?  r)  rD  rD  s        r#  r   zIPolys.dup_factor_list_include[  sA    )$--*:DKKH5<>TQ$//!$a(>>>rR  c                     t        | j                  |      | j                  dz
  | j                        \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w rA  )r   r?  rC  r)  rD  rk  s         r#  r   zIPolys.dmp_factor_list_  rt  rp  c                     t        | j                  |      | j                  dz
  | j                        }|D cg c]  \  }}| j	                  |      |f c}}S c c}}w rA  )r   r?  rC  r)  rD  rD  s        r#  r   zIPolys.dmp_factor_list_includeb  sK    )$--*:DJJqL$++V5<>TQ$//!$a(>>>   Ac                 L    t        | j                  |      | j                        S r  )r   r?  r)  rf  s     r#  r   zIPolys.dup_irreducible_pf  s     q!14;;??r&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )r   r?  rC  r)  rf  s     r#  r   zIPolys.dmp_irreducible_ph  s&     q!14::a<MMr&  c                     t        | j                  |      | j                        }t        t	        | j
                  |            S r  )r   r?  r)  r  r  rD  )r!  rG  seqs      r#  r   zIPolys.dup_sturmk  s1    a($++6C-..r&  c                 L    t        | j                  |      | j                        S r  )r   r?  r)  rf  s     r#  r   zIPolys.dup_sqf_po  s    q)4;;77r&  c                 h    t        | j                  |      | j                  dz
  | j                        S rA  )r   r?  rC  r)  rf  s     r#  r   zIPolys.dmp_sqf_pq  s&    q)4::a<EEr&  c                     t        | j                  |      | j                  dz
  | j                        }| j	                         j                  |      S rA  )r   r?  rC  r)  r-  rD  ra  s      r#  r   zIPolys.dmp_normt  s=    T]]1%tzz!|T[[A~~**1--r&  c                     t        | j                  |      | j                        \  }}}|| j                  |      | j	                         j                  |      fS r  )r   r?  r)  rD  r-  r!  rG  r  r  Rs        r#  r   zIPolys.dup_sqf_normx  sI    t}}Q/=1a4??1%t~~'7'B'B1'EFFr&  c                     t        | j                  |      | j                  dz
  | j                        \  }}}|| j	                  |      | j                         j	                  |      fS rA  )r   r?  rC  r)  rD  r-  r  s        r#  r   zIPolys.dmp_sqf_norm{  sS    t}}Q/At{{K1a4??1%t~~'7'B'B1'EFFr&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  r   r?  r)  rf  s     r#  r   zIPolys.dup_gf_sqf_part  %    t}}Q/?MNNr&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  r   r?  r)  rf  s     r#  r   zIPolys.dmp_gf_sqf_part  r  r&  c                 j    | j                  t        | j                  |      | j                              S r  )rD  r   r?  r)  rf  s     r#  r   zIPolys.dup_sqf_part  s%    |DMM!,<dkkJKKr&  c                     | j                  t        | j                  |      | j                  dz
  | j                              S rA  )rD  r   r?  rC  r)  rf  s     r#  r   zIPolys.dmp_sqf_part  s/    |DMM!,<djjlDKKXYYr&  c                     t        | j                  |      | j                  |      \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w Nall)r   r?  r)  rD  r!  rG  r  ri  rE  rn  rF  s          r#  r   zIPolys.dup_gf_sqf_list  sL    (q)94;;CPwWFTQ$//!,a0FGGF   Ac                     t        | j                  |      | j                  dz
  | j                  |      \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w NrB  r  )r   r?  rC  r)  rD  r  s          r#  r   zIPolys.dmp_gf_sqf_list  sW    (q)94::a<Z]^wWFTQ$//!,a0FGGF   A!c                     t        | j                  |      | j                  |      \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r   r?  r)  rD  r  s          r#  r   zIPolys.dup_sqf_list  sL    %dmmA&6MwWFTQ$//!,a0FGGFr  c                     t        | j                  |      | j                  |      }|D cg c]  \  }}| j                  |      |f c}}S c c}}w r  )r   r?  r)  rD  r!  rG  r  rE  rn  rF  s         r#  r   zIPolys.dup_sqf_list_include  sC    &t}}Q'7#N5<>TQ$//!$a(>>>s   Ac                     t        | j                  |      | j                  dz
  | j                  |      \  }}||D cg c]  \  }}| j	                  |      |f c}}fS c c}}w r  )r   r?  rC  r)  rD  r  s          r#  r   zIPolys.dmp_sqf_list  sW    %dmmA&6

1dkkWZ[wWFTQ$//!,a0FGGFr  c                     t        | j                  |      | j                  dz
  | j                  |      }|D cg c]  \  }}| j	                  |      |f c}}S c c}}w r  )r   r?  rC  r)  rD  r  s         r#  r   zIPolys.dmp_sqf_list_include  sN    &t}}Q'7At{{X[\5<>TQ$//!$a(>>>s   Ac                     t        | j                  |      | j                        }|D cg c]  \  }}| j                  |      |f c}}S c c}}w r  )r   r?  r)  rD  rD  s        r#  r   zIPolys.dup_gff_list  sA    t}}Q/=5<>TQ$//!$a(>>>rR  c                     t        | j                  |      | j                  dz
  | j                        }|D cg c]  \  }}| j	                  |      |f c}}S c c}}w rA  )r   r?  rC  r)  rD  rD  s        r#  r   zIPolys.dmp_gff_list  sK    t}}Q/At{{K5<>TQ$//!$a(>>>r  c                 L    t        | j                  |      | j                        S r  )r   r?  r)  rf  s     r#  r   zIPolys.dup_root_upper_bound  rT  r&  c                 L    t        | j                  |      | j                        S r  )r   r?  r)  rf  s     r#  r   zIPolys.dup_root_lower_bound  rT  r&  c                 R    t        | j                  |      || j                  |      S )N)fast)r   r?  r)  )r!  rG  Mr  s       r#  r   z IPolys.dup_step_refine_real_root  s!    (q)91dkkPTUUr&  c           
      Z    t        | j                  |      || j                  |||||      S )N)epsstepsdisjointr  mobius)r   r?  r)  )r!  rG  r  r  r  r  r  r  s           r#  r   z!IPolys.dup_inner_refine_real_root  s7    )$--*:At{{PS[`ksz~  HN  O  	Or&  c           
      Z    t        | j                  |      ||| j                  ||||      S N)r  r  r  r  )r   r?  r)  r!  rG  r  r  r  r  r  r  s           r#  r   z!IPolys.dup_outer_refine_real_root  s6    )$--*:Aq$++SV^cnv  ~B  C  	Cr&  c           
      Z    t        | j                  |      ||| j                  ||||      S r  )r   r?  r)  r  s           r#  r   zIPolys.dup_refine_real_root  s+    #DMM!$4aDKKSX]hpw{||r&  c                 R    t        | j                  |      | j                  ||      S )N)r  r  )r   r?  r)  )r!  rG  r  r  s       r#  r   z#IPolys.dup_inner_isolate_real_roots  s!    +DMM!,<dkksY]^^r&  c           	      X    t        | j                  |      | j                  |||||      S )N)r  infsupr  r  )r   r?  r)  )r!  rG  r  r  r  r  r  s          r#  r   z'IPolys.dup_inner_isolate_positive_roots  5    /a0@$++SV\_ehos  }C  D  	Dr&  c           	      X    t        | j                  |      | j                  |||||      S )N)r  r  r  r  r  )r   r?  r)  )r!  rG  r  r  r  r  r  s          r#  r   z'IPolys.dup_inner_isolate_negative_roots  r  r&  c           	      X    t        | j                  |      | j                  |||||      S N)r  r  r  r  blackbox)r   r?  r)  r!  rG  r  r  r  r  r  s          r#  r   z!IPolys.dup_isolate_real_roots_sqf  s4    )$--*:DKKSVY_bim  yA  B  	Br&  c           	      X    t        | j                  |      | j                  |||||      S )N)r  r  r  basisr  )r   r?  r)  )r!  rG  r  r  r  r  r  s          r#  r   zIPolys.dup_isolate_real_roots  s*    %dmmA&6RU[^fkrvwwr&  c           
      v    t        t        t        | j                  |            | j                  ||||||      S )N)r  r  r  strictr  r  )r   r  r  r?  r)  )r!  r  r  r  r  r  r  r  s           r#  r   z"IPolys.dup_isolate_real_roots_list  sG    *4DMM50I+JDKK]`fior  |B  JO  VZ  [  	[r&  c                 R    t        | j                  |      | j                  ||      S )N)r  r  )r   r?  r)  )r!  rG  r  r  s       r#  r   zIPolys.dup_count_real_roots  s!    #DMM!$4dkksPSTTr&  c                 T    t        | j                  |      | j                  |||      S )N)r  r  exclude)r   r?  r)  )r!  rG  r  r  r  s        r#  r   zIPolys.dup_count_complex_roots  s$    &t}}Q'7#SV`ghhr&  c                 V    t        | j                  |      | j                  ||||      S )N)r  r  r  r  )r   r?  r)  )r!  rG  r  r  r  r  s         r#  r   z$IPolys.dup_isolate_complex_roots_sqf  s(    ,T]]1-=t{{PSY\bepxyyr&  c           	      X    t        | j                  |      | j                  |||||      S r  )r   r?  r)  r  s          r#  r   z IPolys.dup_isolate_all_roots_sqf  s0    (q)94;;CUX^ahlw  A  	Ar&  c                 V    t        | j                  |      | j                  ||||      S )N)r  r  r  r  )r   r?  r)  )r!  rG  r  r  r  r  s         r#  r   zIPolys.dup_isolate_all_roots  s'    $T]]1%5t{{QTZ]dhiir&  c           	          ddl m} t        t        | j                   || j
                  dz
  | j                                    S )Nr   )dmp_fateman_poly_F_1rB  )sympy.polys.specialpolysr  tupler  rD  rC  r)  )r!  r  s     r#  fateman_poly_F_1zIPolys.fateman_poly_F_1  /    AS*>tzz!|T[[*YZ[[r&  c           	          ddl m} t        t        | j                   || j
                  dz
  | j                                    S )Nr   )dmp_fateman_poly_F_2rB  )r  r  r  r  rD  rC  r)  )r!  r  s     r#  fateman_poly_F_2zIPolys.fateman_poly_F_2  r  r&  c           	          ddl m} t        t        | j                   || j
                  dz
  | j                                    S )Nr   )dmp_fateman_poly_F_3rB  )r  r  r  r  rD  rC  r)  )r!  r  s     r#  fateman_poly_F_3zIPolys.fateman_poly_F_3  r  r&  c           	          t        | j                  |      j                         D cg c]2  }| j                  j                  j                  || j                        4 c}      S c c}w r  )r   r=  r?  r)  domr  )r!  r0  rH  s      r#  to_gf_densezIPolys.to_gf_dense  sG    499U\K]KfKfKhja$++//11!T[[Ajkkjs   7A%c                 |    | j                  t        || j                  dz
  | j                  j                              S rA  )r6  rL   rC  r)  r  r/  s     r#  from_gf_densezIPolys.from_gf_dense  s*    ~~k'4::a<QRRr&  c                 6    t        | j                  |            S r  )r   r  rf  s     r#  r   zIPolys.gf_degree  s    ))!,--r&  c                 `    t        | j                  |      | j                  j                        S r  )r   r  r)  r  rf  s     r#  r   zIPolys.gf_LC  "    T%%a($++//::r&  c                 `    t        | j                  |      | j                  j                        S r  )r   r  r)  r  rf  s     r#  r   zIPolys.gf_TC  r  r&  c                 T    | j                  t        | j                  |                  S r  )r  r   r  rf  s     r#  r   zIPolys.gf_strip  s#    !!(4+;+;A+>"?@@r&  c                 ~    | j                  t        | j                  |      | j                  j                              S r  )r  r   r  r)  rf  rf  s     r#  gf_trunczIPolys.gf_trunc  s-    !!(4+;+;A+>"PQQr&  c                     | j                  t        | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rf  s     r#  	gf_normalzIPolys.gf_normal  <    !!(4+;+;A+>QUQ\Q\Q`Q`"abbr&  c                     | j                  t        || j                  j                  | j                  j                              S r  )r  r   r)  rf  r  rf  s     r#  r   zIPolys.gf_from_dict  s,    !!,q$++//4;;??"STTr&  c                 d    t        | j                  |      | j                  j                  |      S N)	symmetric)r   r  r)  rf  r!  rG  r  s      r#  r   zIPolys.gf_to_dict  s$    $**1-t{{)TTr&  c                 `    | j                  t        || j                  j                              S r  )r  r   r)  rf  rf  s     r#  r   zIPolys.gf_from_int_poly  s#    !!"21dkkoo"FGGr&  c                 d    t        | j                  |      | j                  j                  |      S r  )r   r  r)  rf  r  s      r#  r   zIPolys.gf_to_int_poly  s$    d..q14;;??iXXr&  c                     | j                  t        | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rf  s     r#  r   zIPolys.gf_neg  7    !!&)9)9!)<dkkoot{{"_``r&  c                     | j                  t        | j                  |      || j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  r  s      r#  r   zIPolys.gf_add_ground  >    !!-0@0@0CQY]YdYdYhYh"ijjr&  c                     | j                  t        | j                  |      || j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  r  s      r#  r   zIPolys.gf_sub_ground  r  r&  c                     | j                  t        | j                  |      || j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  r  s      r#  r   zIPolys.gf_mul_ground  r  r&  c                     | j                  t        | j                  |      || j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  r  s      r#  r   zIPolys.gf_quo_ground  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_add  N    !!&)9)9!)<d>N>Nq>QSWS^S^SbSbdhdododsds"tuur&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_sub  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_mul   r  r&  c                     | j                  t        | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rf  s     r#  r   zIPolys.gf_sqr  r  r&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  ru  s       r#  r   zIPolys.gf_add_mul  {    !!*T-=-=a-@$BRBRSTBUW[WgWghiWjlplwlwl{l{  ~B  ~I  ~I  ~M  ~M  #N  O  	Or&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  ru  s       r#  r   zIPolys.gf_sub_mul  r  r&  c           
          | j                  t        t        t        | j                  |            | j
                  j                  | j
                  j                              S r  )r  r   r  r  r  r)  rf  r  )r!  r  s     r#  r   zIPolys.gf_expand
  sC    !!)DT5E5Eq1I,JDKKOO]a]h]h]l]l"mnnr&  c                     t        | j                  |      | j                  |      | j                  j                  | j                  j                        \  }}| j                  |      | j                  |      fS r  )r   r  r)  rf  r  r  r  s        r#  r   zIPolys.gf_div  sb    d&&q)4+;+;A+>QUQ\Q\Q`Q`a1!!!$d&8&8&;;;r&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_rem  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_quo  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_exquo  O    !!(4+;+;A+>@P@PQR@SUYU`U`UdUdfjfqfqfufu"vwwr&  c                     | j                  t        | j                  |      || j                  j                              S r  )r  r   r  r)  r  ra  s      r#  r   zIPolys.gf_lshift  /    !!)D,<,<Q,?DKKOO"TUUr&  c                     | j                  t        | j                  |      || j                  j                              S r  )r  r   r  r)  r  ra  s      r#  r   zIPolys.gf_rshift  r  r&  c                     | j                  t        | j                  |      || j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  ra  s      r#  r   zIPolys.gf_pow  s>    !!&)9)9!)<aRVR]R]RaRa"bccr&  c           	          | j                  t        | j                  |      || j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  )r!  rG  rb  rn  s       r#  r   zIPolys.gf_pow_mod  sQ    !!*T-=-=a-@!TEUEUVWEXZ^ZeZeZiZikokvkvkzkz"{||r&  c                    t        | j                  |      | j                  |      | j                  j                  | j                  j                        \  }}}| j                  |      | j                  |      | j                  |      fS r  )r  r  r)  rf  r  r  )r!  rG  rn  rv  cffcfgs         r#  r  zIPolys.gf_cofactors!  sr    "4#3#3A#68H8H8KT[[__^b^i^i^m^mn3!!!$d&8&8&=t?Q?QRU?VVVr&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_gcd$  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r   r  r)  rf  r  rm  s      r#  r   zIPolys.gf_lcm&  r  r&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r  r  r)  rf  r  rm  s      r#  r  zIPolys.gf_gcdex(  r  r&  c                     | j                  t        | j                  |      | j                  j                  | j                  j
                              S r  )r  r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_monic+  r  r&  c                     | j                  t        | j                  |      | j                  j                  | j                  j
                              S r  )r  r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_diff-  s<    !!'$*:*:1*=t{{PTP[P[P_P_"`aar&  c                     t        | j                  |      || j                  j                  | j                  j                        S r  )r  r  r)  rf  r  r  s      r#  r  zIPolys.gf_eval0  s.    t''*At{{PPr&  c                     t        | j                  |      || j                  j                  | j                  j                        S r  )r  r  r)  rf  r  )r!  rG  r  s      r#  r  zIPolys.gf_multi_eval2  s.    T--a0!T[[__dkkooVVr&  c                     | j                  t        | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r  r  r)  rf  r  rm  s      r#  r  zIPolys.gf_compose5  sO    !!*T-=-=a-@$BRBRSTBUW[WbWbWfWfhlhshshwhw"xyyr&  c           	          | j                  t        | j                  |      | j                  |      | j                  |      | j                  j                  | j                  j
                              S r  )r  r  r  r)  rf  r  )r!  rn  rv  rG  s       r#  r  zIPolys.gf_compose_mod7  s{    !!.1A1A!1DdFVFVWXFY[_[k[klm[nptp{p{pp  BF  BM  BM  BQ  BQ  #R  S  	Sr&  c           	      F   | j                  |      }| j                  |      }| j                  |      }| j                  |      }t        |||||| j                  j                  | j                  j                        \  }}| j                  |      | j                  |      fS r  )r  r	  r)  rf  r  r  )r!  r  brH  rb  rG  UVs           r#  r	  zIPolys.gf_trace_map:  s    QQQQAq!Q4;;??DKKOOL1!!!$d&8&8&;;;r&  c                     | j                  t        || j                  j                  | j                  j                              S r  )r  r
  r)  rf  r  r!  rb  s     r#  r
  zIPolys.gf_randomB  s,    !!)At{{"PQQr&  c                     | j                  t        || j                  j                  | j                  j                              S r  )r  r  r)  rf  r  r  s     r#  r  zIPolys.gf_irreducibleD  s,    !!.DKKOOT[[__"UVVr&  c                     t        | j                  |      | j                  j                  | j                  j                        S r  )r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_irred_p_ben_orG  s,     !1!1!!4dkkoot{{WWr&  c                     t        | j                  |      | j                  j                  | j                  j                        S r  )r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_irred_p_rabinI  ,     0 0 3T[[__dkkooVVr&  c                     t        | j                  |      | j                  j                  | j                  j                        S r  )r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_irreducible_pK  r  r&  c                     t        | j                  |      | j                  j                  | j                  j                        S r  )r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_sqf_pM  s,    ((+T[[__dkkooNNr&  c                     | j                  t        | j                  |      | j                  j                  | j                  j
                              S r  )r  r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_sqf_partP  s<    !!+d.>.>q.A4;;??TXT_T_TcTc"deer&  c                     t        | j                  |      | j                  j                  | j                  j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r  r  r)  rf  r  r  r  s          r#  gf_sqf_listzIPolys.gf_sqf_listR  s\    $T%5%5a%8$++//4;;??[wwHtq!++A.2HHHH   A0c                     t        | j                  |      | j                  j                  | j                  j                        S r  )r  r  r)  rf  r  rf  s     r#  r  zIPolys.gf_QmatrixV  s,    $**1-t{{PPr&  c                     t        | j                  |      | j                  j                  | j                  j                        }|D cg c]  }| j                  |       c}S c c}w r  )r  r  r)  rf  r  r  r!  rG  rE  rn  s       r#  r  zIPolys.gf_berlekampX  J    t//2DKKOOT[[__U0791##A&999   	A$c                     t        | j                  |      | j                  j                  | j                  j                        }|D cg c]  \  }}| j                  |      |f c}}S c c}}w r  )r  r  r)  rf  r  r  rD  s        r#  r  zIPolys.gf_ddf_zassenhaus\  sS    #D$4$4Q$7$++//Z8?A1$$$Q'+AAA   
A+c                     t        | j                  |      | j                  j                  | j                  j                        }|D cg c]  }| j                  |       c}S c c}w r  )r  r  r)  rf  r  r  r!  rG  rb  rE  rn  s        r#  r  zIPolys.gf_edf_zassenhaus_  sJ    #D$4$4Q$7$++//Z0791##A&999r  c                     t        | j                  |      | j                  j                  | j                  j                        }|D cg c]  \  }}| j                  |      |f c}}S c c}}w r  )r  r  r)  rf  r  r  rD  s        r#  r  zIPolys.gf_ddf_shoupc  sS    t//2DKKOOT[[__U8?A1$$$Q'+AAAr   c                     t        | j                  |      | j                  j                  | j                  j                        }|D cg c]  }| j                  |       c}S c c}w r  )r  r  r)  rf  r  r  r"  s        r#  r  zIPolys.gf_edf_shoupf  r  r  c                     t        | j                  |      | j                  j                  | j                  j                        }|D cg c]  }| j                  |       c}S c c}w r  )r  r  r)  rf  r  r  r  s       r#  r  zIPolys.gf_zassenhausj  sJ     0 0 3T[[__dkkooV0791##A&999r  c                     t        | j                  |      | j                  j                  | j                  j                        }|D cg c]  }| j                  |       c}S c c}w r  )r  r  r)  rf  r  r  r  s       r#  r  zIPolys.gf_shoupm  sJ    4++A.Q0791##A&999r  c                     t        | j                  |      | j                  j                  | j                  j                  |      \  }}||D cg c]  }| j                  |       c}fS c c}w )N)method)r  r  r)  rf  r  r  )r!  rG  r(  ri  rE  rn  s         r#  r  zIPolys.gf_factor_sqfq  sV    &t'7'7':DKKOOT[[__eklww@!**1-@@@@s   A+c                     t        | j                  |      | j                  j                  | j                  j                        \  }}||D cg c]  \  }}| j                  |      |f c}}fS c c}}w r  )r  r  r)  rf  r  r  rk  s         r#  r  zIPolys.gf_factort  s\    "4#3#3A#6YwwHtq!++A.2HHHHr  )NNN)F)T)NN)NNNFF)NNNF)NF)NNNFFFr  (0  __name__
__module____qualname__r(  rC  r)  r*  gensr$  r+  r-  r1  r3  r6  r=  r?  rD  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!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rM   rN   rP   rQ   rR   rO   rS   rT   rU   rW   rV   rX   rY   rZ   r[   r\   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   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   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   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   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   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
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r&  r#  r  r     s   GEFED,-OR~R~R~Q_Q_Q_Q_SaMMGUGUYgYgo}o}YgGUJX8ZZ\8hhj88888YY[8ggi;I:HBPYg55JJ,:@P^KY_d:+//LmaI^;;8JLLZq]k63B''M88LL\j////77//6K(((N?LLLLLLLLLL""""""""+1-<<??DR`1
?CX"6@^2
2
27@HHHHHHHHHHH?H?@N/8F.GGOOLZHHH?H???CCVOC}_DDBx[UizAj\\\lS.;;ARcUUHYakkkkvvvaOOo<vvxVVd}WvvxcbQWzS<RWXWWOfIQ:B:B:::AIr&  r  N($  __doc__sympy.polys.densearithr   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"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   sympy.polys.densebasicrC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   sympy.polys.densetoolsrM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   sympy.polys.euclidtoolsrq   rr   rs   rt   ru   rv   rw   rx   ry   rz   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   r   r   r   r   sympy.polys.factortoolsr   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   r   r   sympy.polys.rootisolationr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   sympy.polys.sqfreetoolsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   sympy.polys.galoistoolsr   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  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  sympy.utilitiesr  r  r   r&  r#  <module>r8     s-   > 0 / / / / / 1 1 1 1 1 1 1 1 3 3 - - * * * * * * * * . . . . * * * * * * + + + - + + + - - - - - * * * , * * * , / / . . 6 6 - - ) ) ) ) 0 0 - - 0 . 0 0 3 + + . + + . 0 3 , , 3 , 3 . 5 0 7 . 5 0 - , , , 0 . . 0 + 6 3 3 - 2 2 - - . . 5 5 5 5 ; 5 5 1 ; 5 5 < < < 1 4 4 2 2 2 2 2 2 2 2 1 1 + + . . + . . + / 1 . . 6 6 9 9 6 6 5 8 4 : < 5 1 < ; 6 6 > / 1 3 3 3 3 2 2 1 1 3 ; 3 ; 5 5 / : : ? @ @ : B F F @ < A : = C ? ;D D D D D	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 # "NI NI NIr&  