+
    0i                        R t ^ RIt^ RIHt ^ RIHtHtHtHt ^ RI	t	^ RI	H
t ^ RIHt ^ RIHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHt ^ RI H!t" . ROt#RR lt$RR	 lt% ! R
 R4      t&R t']	PP                  PS                  R]PT                  ]PV                  .4      R 4       t,]	PP                  PS                  R]PT                  ]PV                  .4      R 4       t-R t.R t/]	PP                  PS                  R]#4      R 4       t0R t1R t2R t3R t4R t5]	PP                  PS                  R]#4      R 4       t6R t7R t8]	PP                  PS                  R]#4      R 4       t9R t:R# ) z)test sparse matrix construction functionsN)array)assert_equalassert_assert_array_equalassert_array_almost_equal_nulp)raises)check_free_memory)
csr_matrix
coo_matrix	csr_array	coo_array	csc_array	bsr_array	dia_array	dok_array	lil_array
csc_matrix
bsr_matrix
dia_matrix
lil_matrixsparrayspmatrix
_construct)randc           	          \         P                  P                  V4      pVP                  p\        P                  ! WW#WEV4      # N)nprandomdefault_rngstandard_normal	construct)mndensityformatdtyperngdata_rvss   &&&&&& _/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/sparse/tests/test_construct.py_sprandnr)      s8    
))


$C""HA'5xHH    c           	          \         P                  P                  V4      pVP                  p\        P
                  ! W3W#VWVR 7      # ))r#   r$   r%   r&   data_sampler)r   r   r   r   r    random_array)r!   r"   r#   r$   r%   r&   r,   s   &&&&&& r(   _sprandn_arrayr.   !   sB    
))


$C&&L!!1&'PU&)F Fr*   c            
         a  ] tR t^)t o ]P
                  P                  R]]]	]
]]].4      R 4       t]P
                  P                  R]]]]]].4      R 4       tR tR tR tR tR tR	 tR
 tR tR t]P
                  P                  R]P@                  ]PB                  .4      R 4       t"]P
                  P                  R]PF                  ]PB                  .4      R 4       t$]P
                  P                  R]PF                  ]PB                  .4      R 4       t%R t&]P
                  P                  R^ ^ .^ ^..RR3^^ .^^..RR3^^ .^^...RR3.4      R 4       t'R t(R t)R t*R t+R t,]P
                  P                  R]]	.4      R 4       t-R t.R  t/R! t0]P
                  P                  R]]	.4      R" 4       t1R# t2]P
                  P                  R$]Pf                  ]Ph                  34      R% 4       t5R& t6R' t7]P
                  Pp                  ]P
                  Ps                  R(4      R) 4       4       t:R* t;R+ t<R, t=R- t>R. t?R/ t@R0 tA]P
                  P                  R1RR2]BP                  P                  R24      .4      R3 4       tE]P
                  P                  R1RR2]BP                  P                  R24      .4      R4 4       tFR5 tGR6 tHR7 tIR8 tJR9tKV tLR# ):TestConstructUtilsclsc                    \         P                  ! \        R R7      ;_uu_ 4        V! ^ 4       RRR4       R#   + '       g   i     R# ; i)zEscipy sparse array classes do not support instantiation from a scalarmatchN)pytestr   
ValueErrorselfr1   s   &&r(    test_singleton_array_constructor3TestConstructUtils.test_singleton_array_constructor+   s;    
 ]].
 
 F
 
 
 
s	   	8A		c                8    V! ^ 4      P                   R8X  g   Q hR# )a  
This test is for backwards compatibility post scipy 1.13.
The behavior observed here is what is to be expected
with the older matrix classes. This test comes with the
exception of dok_matrix, which was not working pre scipy1.12
(unlike the rest of these).
N   r=   shaper7   s   &&r(   !test_singleton_matrix_constructor4TestConstructUtils.test_singleton_matrix_constructor9   s     1v||v%%%r*   c                   \        . RO.4      p\        . RO. RO.4      p\        . RO. RO. RO.4      p. pVP                  V^ ^^^..34       VP                  V^ .^^^..34       VP                  V^ .^^^.^ ..34       VP                  V^ .^^^^ ..34       VP                  V^.^^^ ^..34       VP                  VR.^^^ ^ ..34       VP                  V^ .^^^^ .^ ^..34       VP                  VR.^^^ ^ .^^ ..34       VP                  V^.^^^ ^ .^ ^ ..34       VP                  V^ .^^. RO. RO. RO.34       VP                  V^.^^. RO. RO. R	O.34       VP                  V^.^^. R
O. RO. RO.34       VP                  V^ ^.^^. RO. RO. RO.34       VP                  VR^ .^^. RO. RO. RO.34       VP                  V^R.^^. RO. RO. RO. RO. RO. RO.34       VP                  V. RO^^. RO. RO. RO. RO. RO. RO.34       VP                  V. R O^^. R!O. R"O. R#O. R$O. R%O. R&O.34       VP                  V. R'O\        V^ ,          4      \        V^ ,          4      . R(O. R)O. R*O. R+O. RO.34       V F  w  rVrxp	\        V^ ,          4      V8X  d5   Wx8X  d/   \        \        P
                  ! WV4      P                  4       V	4       \        \        P
                  ! WVWx4      P                  4       V	4       \        \        P
                  ! WVWx34      P                  4       V	4       K  	  R# ),r=   Nr=               )         	   
   )               r=       rT   rT   rT   rD   rT   rT   rT   rT   rE   rT   )rT   rT   rT   rF   rT   rT   rE   rT   rT   )rT   rT   rT   rF   rT   )rT   rT   rT   rT   rG   )r=   rT   rJ   rT   rD   rT   rT   rT   rE   rH   rT   rT   rT   r=   rI   rT   rT   rT   rD   rJ   rT   )rT   rT   rE   rT   rT   rT   )rT   rT   rT   rF   rT   rT   )rT   rT   rT   rT   rG   rT   )rH   rT   rT   rT   rT   rT   rT   rI   rT   rT   rT   rT   rT   rT   rJ   rT   rT   rT   rR   rT   r=   )rH   rN   rT   rT   rT   rT   )r=   rI   rO   rT   rT   rT   )rT   rD   rJ   rP   rT   rT   )rT   rT   rE   rK   rQ   rT   )rT   rT   rT   rF   rL   rT   rD   rR   )rT   rT   rJ   rT   rT   )rM   rT   rT   rK   rT   )rT   rN   rT   rT   rL   rT   rT   rO   rT   rT   r=   rT   rT   rP   rT   rT   rD   rT   rT   rQ   )rR   r=   rD   )rT   rI   rO   rT   rT   )r=   rT   rJ   rP   rT   )rT   rD   rT   rK   rQ   )rT   rT   rE   rT   rL   )r   appendlenr   r    spdiagstoarray)
r8   diags1diags2diags3casesdor!   r"   results
   &         r(   test_spdiagsTestConstructUtils.test_spdiagsG   sk   ()(* +()+ , faAu-.fqc1a1#/0fqc1a1#qc34fqc1a1Q%12fqc1a1Q%12fbT1a1Q%12fqc1a1Q%178fbT1a1Q%178fqc1a1Q%178fqc1a)Ii)HIJfqc1a)Ii)HIJfqc1a+k+)NOPfqeQGGG+DEFfr!faYy,KLMfqfa].;.;.;.;.;-= > 	? 	fh1/A0B0B0B0B0B/D E 	F 	fiA1A1@1@1@1@0B C 	D 	fj#fQi.#fQi.''''&	() 	* #(A!1Q4yA~!&Y..q4<<>G**16>>@&I**1!8@@BFK	 #(r*   c                R   \        . RO4      p\        . RO4      p\        . RO4      p. pVP                  VR,          ^ R^..34       VP                  VR,          .^ .R^..34       VP                  VR,          .^ .R^.^ ..34       VP                  VR,          .^ .R^^ ..34       VP                  VR,          .^.R^ ^..34       VP                  VR,          .^ .R^^ .^ ^..34       VP                  VR,          .R.R^ ^ .^^ ..34       VP                  VR,          .^ .R. RO. RO. RO.34       VP                  VR,          .^.R. RO. RO. RO.34       VP                  VR,          .R.R. RO. RO. RO.34       VP                  VR,          .R.R. RO. RO. RO.34       VP                  VR,          .^ .R. RO. RO. RO.34       VP                  VR,          .^.R. R O. R!O. R"O.34       VP                  VR,          .^.R. R#O. R$O. R%O.34       VP                  VR,          .^.R. R&O. R'O. RO.34       VP                  VR,          .^.R. R(O. RO. RO.34       VP                  VR,          .R).R*. R+O. R+O. R+O. R+O. R,O.34       VP                  VR,          .R-.R*. R+O. R+O. R+O. R,O. R.O.34       VP                  VR,          .R.R*. R+O. R+O. R,O. R.O. R/O.34       VP                  VR,          .R.R*. R+O. R,O. R.O. R/O. R+O.34       VP                  VR,          .^ .R*. R,O. R.O. R/O. R+O. R+O.34       VP                  VR,          .^.R*. R0O. R1O. R+O. R+O. R+O.34       VP                  VR,          .^.R*. R2O. R+O. R+O. R+O. R+O.34       VP                  VR,          VR,          .^ ^.R3. R4O. R.O. R/O.34       VP                  VR,          VR,          .R^ .R. R5O. R6O. R7O.34       VP                  VR,          VR,          .^R-.R8. R9O. R:O. R;O. R<O. R=O. R>O.34       VP                  VR,          W#R,          .. R?OR@. RAO. RBO. RCO. RDO. REO.34       VP                  VR,          VR,          V.. RFORG. RHO. RIO. RJO. RKO. RLO. RMO.34       VP                  V.^ .R^..34       VP                  VR,          V.^ ^.R3. R4O. R.O. R/O.34       VP                  \        P                   ! . RNO. ROO.4      ^ R.R3. R,O. RPO. RQO.34       VP                  . RRO. RSOR3. RTO. RUO. RVO.34       V F  w  rVrxV: RV: RV: RV: 2p	\        \        P
                  ! WVVR7      P                  4       WR7       V^ ,          V^,          8X  g   K_  \        V^ ,          R4      '       g   Kz  \        V^ ,          4      \        V4      8:  g   K  \        \        P
                  ! WVR	7      P                  4       WR7       K  	  R
# )W      ?:Nr=   NNrD   NNrE   NNrF   N offsetsr?   )err_msg__len__rz   Nrt          @      @      @      @      @g      @g       @g      "@g      $@g      &@g      (@g      *@g      ,@g      .@r<   rD   r=   r=   rD   rD   rD   rR   )rE   rF   rS   rU   rV   )rT   r=   rT   rT   )rT   rT   rD   rT   )rT   rT   rT   rE   rE   rG   )rT   rT   rT   rT   rT   )r=   rT   rT   rT   rT   )rT   rD   rT   rT   rT   rW   )rT   r=   rT   rT   rT   )rT   rT   rD   rT   rT   )rT   rT   rT   rE   rT   )rT   rT   r=   rT   rT   )rT   rT   rT   rD   rT   )rT   rT   rT   rT   rE   )rT   rT   rT   r=   rT   )rT   rT   rT   rT   rD   )rT   rT   rT   rT   r=   rb   )rG   rE   rT   rT   rT   r=   rT   rT   r]   rX   rY   rT   r=   rT   )rT   rT   rD   rT   rT   r=   rE   rE   )r=   rT   rH   rZ   r[   r\   )rH   rH   )rT   rT   r=   rT   rT   rT   )rT   rT   rT   rD   rT   rT   )rT   rT   rT   rT   rE   rT   )rH   rT   rT   rT   rT   rF   r^   r_   r`   rG   rG   )rH   rM   rT   rT   rT   )r=   rI   rN   rT   rT   )rT   rD   rJ   rO   rT   )rT   rT   rE   rK   rP   )rT   rT   rT   rF   rL   ra   rH   rG   )rT   rT   rH   rT   rT   )rM   rT   rT   rI   rT   )rT   rN   rT   rT   rJ   rc   rd   re   )rt   r   r   )r   r   r   )rF   rD   rT   )rT   rG   rE   )rt   g       rt   )r=   rT   rR   )r   r=   rT   )r=   r   r=   )rT   r=   r   )
r   rf   r   r   r    diagsri   hasattrrg   max)
r8   abcrm   rn   ro   r?   rp   r{   s
   &         r(   
test_diagsTestConstructUtils.test_diags   s   +,,-01aeQ!./qugsFaSE23qugsFaS!I67qugsFaUG45qugsFaUG45qugsFaUAa5M:;qugrdFaUAa5M:;qugsFYy,KLMqugsFYy,KLMqugtVk+k-RSTqugtVk+k-RSTqugsF[[,QRSqugsF[[,QRSqugsF[[,QRSqugsF[[,QRSqugsF[[,QRSqugtVggggg-VWXqugtVggggg-VWXqugtVggggg-VWXqugtVggggg-VWXqugsFWWWWW,UVWqugsFWWWWW,UVWqugsFWWWWW,UVWquQrUmaUFWWW4MNOquQrUmbVVi	)5TUVquQrUmaVVm5B5B5B5B5B6D E 	F 	quQuox/<K<K<K<K	:M N 	O
 	quQrU1oy&?:J:I:I:I:I;K L 	M 	qcA3!./quQi!AIy0QRSHHo78rF	9-	
 	 	nh9C9C9E F 	G $)A%Qqe1UIQvj9GUCKKM2 aE!H$AaD),,!IU+Y__Q:BBD#6 $)r*   c                    \        . RO4      p\        \        P                  ! V4      P	                  4       \
        P                  ! V4      4       R# )rt   Nr~   )r   r   r    r   ri   r   diagr8   r   s   & r(   test_diags_default%TestConstructUtils.test_diags_default   s1    +,Y__Q'//12771:>r*   c                f    \        . RO. RO.4      p\        \        \        P                  V4       R# )r=   NrC   )rD   rE   rF   rG   rH   )r   assert_raisesr6   r    r   r   s   & r(   test_diags_default_bad)TestConstructUtils.test_diags_default_bad   s!    ?O45j)//15r*   c           	        \        . RO4      p\        . R	O4      p\        . R
O4      p. pVP                  VR,          .^ R34       VP                  VR,          W#R,          .. ROR34       VP                  VR,          W2R,          .. ROR34       VP                  VR,          W2R,          .. ROR34       VP                  . . ROR34       VP                  R .R.R34       VP                  V.^ R34       V F'  w  rVp\        \        \        P
                  WVVR7       K)  	  \        \        \        P
                  R..^ .R7       R# )rt   :NrT   Nrw   rv   ru   Nry   r}   r~   r   r   r<   r`   r   ra   r   rF   rF   )r   rf   r   r6   r    r   	TypeError)r8   r   r   r   rm   rn   ro   r?   s   &       r(   test_diags_bad!TestConstructUtils.test_diags_bad   s   +,,-01qugq&)*quQuox89quQuoy&9:quQuoy$78b)T*+sebT6*+qc1d^$ KA%*iooq5Q ! 	iD6(QCHr*   c                ^   \         P                  P                  R 4      pR EF{  p^V^,          ,           VP                  ^ ^
4      ,           p\         P                  ! V) ^,           V^,
          4      pVP                  V4       VRV pV Uu. uF#  qQP                  V\        V4      ,
          4      NK%  	  pp\        P                  ! WdR7      p\        \        Wd4       UU	u. uF  w  r\         P                  ! W4      NK  	  up	p4      p
\        VP                  4       V
4       \        V4      ^8X  g   EK  \        P                  ! V^ ,          V^ ,          R7      p\         P                  ! V^ ,          V^ ,          4      p
\        VP                  4       V
4       EK~  	  R# u upi u up	pi )i  Nr}   )r=   rD   rE   rF   rG   rL   )r   r   RandomStaterandintarangeshuffler   absr    r   sumzipr   r   ri   rg   )r8   r&   n_diagsr"   rz   q	diagonalsmatxj	dense_mats   &          r(   test_diags_vs_diag%TestConstructUtils.test_diags_vs_diag   s4    ii##D)*GGQJQ!33Aii1ac*GKK hw'G7>?w!!c!f*-wI?//)=Cs97NO7NtqRWWQ]7NOPI*3;;=)D7|q ooilGAJGGGIaL'!*=	.s{{}iH# + @ Ps   )F$"!F)c                    \         P                  ! R .^ .R\        R7      p\        VP                  \        4       \        VP                  4       ^^ .^ ^..4       R# )g@rz   r?   r%   Nr   )r    r   intr   r%   ri   r8   r   s   & r(   test_diags_dtype#TestConstructUtils.test_diags_dtype  sE    OOSEA3fCHQWWc"QYY[Aq6Aq6"23r*   c           	         . ROp\        R^4       FX  p\        \        P                  ! WR7      P	                  4       \        P                  ! V.V.R7      P	                  4       4       KZ  	  R# )        r}   N)r   rt   r   r   r   r   )ranger   r    r   ri   )r8   rn   ks   &  r(   test_diags_one_diagonal*TestConstructUtils.test_diags_one_diagonal  sO    %r1A6>>@"!qc:BBDF r*   c                ^    \         P                  ! . 4      p\        VP                  R4       R# )rT   NrT   rT   )r    r   r   r?   r   s   & r(   test_diags_empty#TestConstructUtils.test_diags_empty  s    OOBQWWf%r*   identityc                   \        V! ^4      P                  4       ^..4       \        V! ^4      P                  4       ^^ .^ ^..4       V! ^RRR7      p\        VP                  \        P                  ! R4      4       \        VP                  R4       \
         FF  pV! ^VR7      p\        VP                  V4       \        VP                  4       . RO. RO. RO.4       KH  	  R# 	r=   int8dia)r%   r$   r$   Nr   r   r   r   ri   r%   r   r$   sparse_formats)r8   r   Ifmts   &&  r(   test_identity TestConstructUtils.test_identity  s    Xa[((*aSE2Xa[((*aUAa5M:QfU3QWWbhhv./QXXu%!C3'A3'www&?@ "r*   eyec                   \        V! ^^4      P                  4       ^..4       \        V! ^^4      P                  4       . RO. RO.4       \        V! ^^4      P                  4       ^^ .^ ^.^ ^ ..4       \        V! ^^4      P                  4       . RO. RO. R	O.4       \        V! ^^RR7      P                  \        P                  ! R4      4       R
 F  pR
 F  p\	        R^4       F  pV^ 8  d   WC8  g   V^ 8  dJ   \        V4      V8  d:   \        P                  ! \        RR7      ;_uu_ 4        V! W#VR7       RRR4       K`  \        V! W#VR7      P                  4       \        P                  ! W#VR7      4       W#8X  g   K  \        V! W$R7      P                  4       \        P                  ! W#VR7      4       K  	  K  	  K  	  R#   + '       g   i     K  ; i)r=   int16r%   zOffset.*out of boundsr3   r   Nr   r   r   r   r   )
r   ri   r%   r   r   r   r5   r   r6   r   )r8   r   r!   r"   r   s   &&   r(   test_eyeTestConstructUtils.test_eye   s   S1X%%'1#/S1X%%'''):;S1X%%'1Q%1qe)<=S1X%%'''')BCS17+11288G3DEAr!A A!%QUs1vz#]]&.E   N  %N224FF11- 6( #A 3 3 5 "qq 1) %    s   3GGc                   \        V! ^4      P                  4       ^..4       \        V! ^4      P                  4       ^^ .^ ^..4       V! ^RRR7      p\        VP                  \        P                  ! R4      4       \        VP                  R4       \
         FF  pV! ^VR7      p\        VP                  V4       \        VP                  4       . RO. RO. RO.4       KH  	  R# r   r   )r8   r   r   r   s   &&  r(   test_eye_oneTestConstructUtils.test_eye_oneD  s    SV^^%u-SV^^%1qe}5.QWWbhhv./QXXu%!CAc"A3'www&?@ "r*   c                    \        \        P                  ! ^4      \        4      '       g   Q h\        \        P                  ! ^4      \        4      '       d   Q hR# )rE   N)
isinstancer    	eye_arrayr   r   r8   s   &r(   test_eye_array_vs_matrix+TestConstructUtils.test_eye_array_vs_matrixR  s?    )--a0'::::immA.88888r*   zarr,kw_format,out_formatNcoobsrc                   \        V4      p\        P                  ! WDVR 7      P                  V8X  g   Q h\        P                  ! WAVR 7      P                  V8X  g   Q h\        P                  ! WVR 7      P                  V8X  g   Q hR# )r   N)r   r    kronr$   )r8   arr	kw_format
out_formatsparrs   &&&& r(   test_kron_output_format*TestConstructUtils.test_kron_output_formatV  sj     #~~e9=DD
RRR~~e;BBjPPP~~c;BBjPPPr*   c           	        . pVP                  \        ^ ..4      4       VP                  \        R..4      4       VP                  \        ^..4      4       VP                  \        ^
..4      4       VP                  \        ^ .^ ..4      4       VP                  \        ^ ^ ..4      4       VP                  \        ^^.^^..4      4       VP                  \        ^ ^.^^ ..4      4       VP                  \        . RO. RO.4      4       VP                  \        ^^.^ ^ .^^ ..4      4       VP                  \        . RO. R	O. R
O.4      4       VP                  \        . RO.4      4       VP                  \        . RO. RO.4      4       V F  p\        V4      pV F  p\        V4      p\        P                  ! W$4      p\
        R,           Fc  p\        P                  ! W5VR7      p\        VP                  V4       \        VP                  4       V4       \        V\        4      '       d   Kc  Q h	  K  	  K  	  VP                  \        . RO4      4       VP                  \        . RO. RO..4      4       VP                  \        ^ ^..^^..^^ ..^^ ...4      4       V Fj  p\        V4      pV FV  p\        V4      p\        P                  ! W$4      p\        P                  ! W5RR7      p\        VP                  4       V4       KX  	  Kl  	  \        . RO. RO.4      p\        . RO. R	O. R
O.4      p\        V4      p\        V4      p\        P                  ! W$4      p\
         Fc  p\        P                  ! W5VR7      p\        VP                  V4       \        VP                  4       V4       \        V\        4      '       d   Kc  Q h	  \        P                  ! \        V4      \        V4      XR7      p\        VP                  V4       \        VP                  4       V4       \        V\        4      '       g   Q hR# )rT   :r=   rF   Nr   r   NrR   rT   rD   irJ   rT   rP   )rG   rF   rF   r   )rH   rT   rJ   )rT   r=   rT   rD   rT   rG   rJ   )      ?g      ?rT   g      
@)rT   g      @rT   rT   )rT   r=   rD   r   )rf   r   r   r   r   r   r    r   r$   r   ri   r   r   r   r	   r   )	r8   rm   r   car   cbexpectedr   rp   s	   &        r(   	test_kronTestConstructUtils.test_krona  sW   UQC5\"URD6]#UQC5\"URD6]#UQC!:&'UQF8_%UQFQF+,-UQFQF+,-UJ
345UQFQFQF345UIy)<=>U1234U1>BCD A1Bq\771=)#..C&^^B3?F 4&v~~'7B%fg6666	 /   	U9%&UY	2345UaVH1vh!QAq6(CDEA1Bq\771="u="6>>#3X>	   (.9:9i34q\q\771=!C^^B37F,v~~/:fg....	 " 
1z!}SIV]]C(6>>+X6&(++++r*   c                4   \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! ^ .^..^ ^...4       RRR4       \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! ^^...^.^..4       RRR4       \        P                  ! \        ^ ^...4      ^ .^...4       \        P                  ! ^ ^...\        ^ .^...4      4       \        P                  ! ^ .^... RO4       \        P                  ! ^^.^.^..4       \        P                  ! ^ .^..\        . RO4      4       \        P                  ! \        ^^.4      ^.^..4       R#   + '       g   i     EL7; i  + '       g   i     L; i)zexpected 2D array or matrixr3   Nr   )r5   r   r   r    r   r   r   s   &r(   test_kron_ndim_exceptions,TestConstructUtils.test_kron_ndim_exceptions  s:   ]]9,IJJNNQC!:!Qz2 K]]9,IJJNNaVH:aSz2 K 	yAq6(,aSzl;!Qz9sQCj\#:; 	aSz9-1vaSz*aSz9Y#78y!Q(A3*5 KJJJJs    E31 F3F	F	c                    Rp\         P                  ! ^.^V3V^,
          RR7      p\         P                  ! ^.V^3^V,
          RR7      p\         P                  ! W"4       \         P                  ! W34       R# )rD   N)r?   rz   r%   i   )r    diags_arrayr   )r8   r"   r   r   s   &   r(   test_kron_large"TestConstructUtils.test_kron_large  s_    !!1#aVQqSM!!1#aVQqSMqqr*   c           
        . pVP                  \        ^ ..4      4       VP                  \        R..4      4       VP                  \        ^..4      4       VP                  \        ^
..4      4       VP                  \        ^^.^^..4      4       VP                  \        ^ ^.^^ ..4      4       VP                  \        . RO. RO. RO.4      4       VP                  \        . RO. RO. RO.4      4       V F  pV F  p\        P                  ! \	        V4      \	        V4      4      P                  4       p\        P                  ! \        P                  ! VP                  ^ ,          4      V4      \        P                  ! V\        P                  ! VP                  ^ ,          4      4      ,           p\        WE4       K  	  K  	  \        P                  ! \        X4      \        X4      4      P                  4       p\        VX4       R# )	rT   NrR   r   r   )rT   rE   rT   r   )rT   rG   rR   )rF   r   rJ   )rf   r   r    kronsumr   ri   r   r   r   r?   r   r	   )r8   rm   r   r   rp   r   s   &     r(   test_kronsumTestConstructUtils.test_kronsum  sv   UQC5\"URD6]#UQC5\"URD6]#UQqE1Q%=)*UQqE1Q%=)*UHXg678UGHX678 A"**9Q<1FNNPGGBFF1771:$6: gga
);<="64	   "":a=*Q-@HHJ68,r*   c           	        \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! ^ .^..\        ^ ^.4      4       RRR4       \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! \        ^ ^.4      ^ .^..4       RRR4       \        P                  ! ^ ^.^^ ..^.4       R#   + '       g   i     L; i  + '       g   i     LC; i)zrequires 2D inputr3   N)r5   r   r6   r    r  r   r   s   &r(   test_kronsum_ndim_exceptions/TestConstructUtils.test_kronsum_ndim_exceptions  s    ]]:-@AAsQCj)QF*;< B]]:-@AAiA/1#s< B 	Aq6Aq6*QC0 BAAAs   'C8'CC	C*	coo_clsc                ,   V! ^^.^^..4      pV! ^^..4      p\        ^^.^^.^^..4      p\        \        P                  ! W#.4      P	                  4       V4       \        \        P                  ! W#.\
        P                  R7      P                  \
        P                  4       \        \        P                  ! VP                  4       VP                  4       .4      P	                  4       V4       \        \        P                  ! VP                  4       VP                  4       .4      P	                  4       V4       \        P                  ! VP                  4       VP                  4       .R\
        P                  R7      p\        VP                  \
        P                  4       \        VP                  P                  \
        P                  4       \        VP                  P                  \
        P                  4       \        \        P                  ! VP                  4       VP                  4       .4      P	                  4       V4       \        P                  ! VP                  4       VP                  4       .R\
        P                  R7      p\        VP                  \
        P                  4       \        VP                  P                  \
        P                  4       \        VP                  P                  \
        P                  4       R# )r=   r   csr)r$   r%   cscN)r   r   r    vstackri   r   float32r%   todoktocsrindicesint32indptrtocsc)r8   r  ABr   rp   s   &&    r(   test_vstackTestConstructUtils.test_vstack  s
   aUAa5M"aUG1a&a&a&" # 	Y%%qf-557BY%%qfBJJ?EEZZ	! 	Y%%qwwy!'')&<=EEGRY%%qwwy!'')&<=EEG	!!1779aggi"8).bjjBV\\2::.V^^))2884V]](("((3Y%%qwwy!'')&<=EEG	!!1779aggi"8).bjjBV\\2::.V^^))2884V]](("((3r*   c                   \        . RO. RO. RO.4      pVP                  P                  \        P                  4      Vn        VP
                  P                  \        P                  4      Vn        \        P                  ! W.4      P                  P                  \        P                  8X  g   Q h\        P                  ! W.4      P                  P                  \        P                  8X  g   Q h\        . RO. RO. RO.4      pVP                  P                  \        P                  4      Vn        VP
                  P                  \        P                  4      Vn        \        P                  ! W.4      P                  P                  \        P                  8X  g   Q h\        P                  ! W.4      P                  P                  \        P                  8X  g   Q h\        . RO. RO. RO.4      p\        ;QJ d    . R VP                   4       F  NK  	  5M! R VP                   4       4      Vn        \        P                  ! W.4      P                  ^ ,          P                  \        P                  8X  g   Q h\        P                  ! W.4      P                  ^ ,          P                  \        P                  8X  g   Q hR# )r=   c              3   ^   "   T F#  qP                  \        P                  4      x  K%  	  R # 5ir   astyper   int64.0cos   & r(   	<genexpr>ITestConstructUtils.test_vstack_maintain64bit_idx_dtype.<locals>.<genexpr>       @x288,,x   +-Nr   r   )r   r  r  r   r  r  r    r  r%   hstackr   r   tuplecoordsr8   Xs   & r(   #test_vstack_maintain64bit_idx_dtype6TestConstructUtils.test_vstack_maintain64bit_idx_dtype  s   y)Y7888??288,II$$RXX.	'..44@@@'..44@@@y)Y7888??288,II$$RXX.	'..44@@@'..44@@@y)Y785@qxx@55@qxx@@'..q177288CCC'..q177288CCCr*   c                    ^^.^^..p^^..p\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q h\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q h\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q h\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q hR# r=   N)r   r    r  r   r   r
   r   r8   r  r  s   &  r(   test_vstack_matrix_or_array.TestConstructUtils.test_vstack_matrix_or_array  s    UAa5MUG)**IaL)A,+GH'RRRR)**IaL*Q-+HI7SSSS)**JqM9Q<+HI7SSSS)**JqM:a=+IJHUUUUr*   c           	     B   \        . RO. RO.4      p\        . RO4      p\        . RO4      p\        P                  ! V\        P
                  ! . RO4      .4      P                  R8X  g   Q h\        P                  ! V\        P
                  ! ^ ..4      .4      P                  R	8X  g   Q h\        P                  ! W".4      P                  R
8X  g   Q h\        P                  ! W".4      P                  R8X  g   Q h\        P                  ! W.4      P                  R8X  g   Q h\        P                  ! W".4      P                  R
8X  g   Q h\        P                  ! W#.4      P                  R
8X  g   Q h\        P                  ! W.4      P                  R8X  g   Q h\        P                  ! W#.4      P                  R8X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        \        P                  ! V\        P
                  ! ^ ^ .4      .4       RRR4       \        P                  ! \        RR7      ;_uu_ 4        \        P                  ! V\        P
                  ! ^ ^ .4      .4       RRR4       R#   + '       g   i     Lm; i  + '       g   i     R# ; i)r=   zincompatible row dimensionsr3   Nzincompatible column dimensionsr   r   r   r   )r=   rF   )r=   rH   )rD   rE   )rD   rH   )r   r   r    r  r   r   r?   r#  r5   r   r6   )r8   r   arr1darr1dcoos   &   r(   test_vstack_1d_with_2d)TestConstructUtils.test_vstack_1d_with_2d  s   I./)$Y'bhhy&9 :;AAVKKK1# 89??6III/55???/55??? 
+11V;;;/55??? 1288FBBB066&@@@ 1288FBBB]]:-JKKc288QF#345 L]]:-MNNc288QF#345 ON LKNNNs   &/I:/J:J
	J	c                   V! ^^.^^..4      pV! ^.^..4      p\        . RO. RO.4      p\        \        P                  ! W#.4      P	                  4       V4       \        \        P                  ! W#.\
        P                  R7      P                  \
        P                  4       \        \        P                  ! VP                  4       VP                  4       .4      P	                  4       V4       \        \        P                  ! VP                  4       VP                  4       .4      P	                  4       V4       \        \        P                  ! VP                  4       VP                  4       .\
        P                  R7      P                  \
        P                  4       \        \        P                  ! VP                  4       VP                  4       .4      P	                  4       V4       \        \        P                  ! VP                  4       VP                  4       .\
        P                  R7      P                  \
        P                  4       R# )r=   r   Nr=   rD   rG   rE   rF   rH   )r   r   r    r#  ri   r   r  r%   r  r  r  )r8   r  r  r  r   s   &&   r(   test_hstackTestConstructUtils.test_hstack'  s   aUAa5M"aS!I)#% &Y%%qf-557BY%%qfBJJ?EEZZ	! 	Y%%qwwy!'')&<=EEGRY%%qwwy!'')&<=EEG	Y%%qwwy!'')&<,.JJ88=ZZ	! 	Y%%qwwy!'')&<=EEG	Y%%qwwy!'')&<,.JJ88=ZZ	!r*   c                "   ^^.^^..p^.^..p\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q h\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q h\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q h\        \        P                  ! \        V4      \        V4      .4      \        4      '       g   Q hR# r+  )r   r    r#  r   r   r
   r   r,  s   &  r(   test_hstack_matrix_or_array.TestConstructUtils.test_hstack_matrix_or_array?  s    UAa5MS!I)**IaL)A,+GH'RRRR)**IaL*Q-+HI7SSSS)**JqM9Q<+HI7SSSS)**JqM:a=+IJHUUUUr*   block_arrayc                `   \        ^^.^^..4      p\        ^.^..4      p\        ^..4      p\        R	4      p\        . R
O. RO. RO.4      p\        V! W#.RV..4      P                  4       V4       \	        R\
        P                  R7      p\        V! VP                  4       VP                  4       .WtP                  4       ..4      P                  4       V4       \        V! VP                  4       VP                  4       .VP                  4       VP                  4       ..4      P                  4       V4       \        . RO. RO. RO.4      p\        V! VR.RV..4      P                  4       V4       \        V! VP                  4       VP                  P                  4       .WtP                  4       ..4      P                  4       V4       \        V! VP                  4       VP                  P                  4       .VP                  4       VP                  4       ..4      P                  4       V4       \	        R\
        P                  R7      p\        ^ ^.^ ^.^^ ..4      p\        V! RV.VR..4      P                  4       V4       \        V! VP                  P                  4       VP                  4       .VP                  4       V..4      P                  4       V4       \        V! VP                  P                  4       VP                  4       .VP                  4       VP                  4       ..4      P                  4       V4       \
        P                  ! R	4      p\        V! RR..4      P                  4       V4       \        V! RV.VR..4      P                  4       V4       \        ^..4      p\        V! RV.VR..4      P                  4       V4       \        \        4      ;_uu_ 4       p	V! V.V..4       RRR4       X	P                  R4       \        \        4      ;_uu_ 4       p	V! VP                  4       .VP                  4       ..4       RRR4       V	P                  R4       \        \        4      ;_uu_ 4       p	V! VP                  4       .VP                  4       ..4       RRR4       V	P                  R4       \        \        4      ;_uu_ 4       p	V! W$..4       RRR4       V	P                  R4       \        \        4      ;_uu_ 4       p	V! VP                  4       VP                  4       ..4       RRR4       V	P                  R4       \        \        4      ;_uu_ 4       p	V! VP                  4       VP                  4       ..4       RRR4       V	P                  R4       R#   + '       g   i     EL; i  + '       g   i     EL|; i  + '       g   i     EL7; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i)r=   Nr   z.Got blocks\[1,0\]\.shape\[1\] == 1, expected 2z"incompatible dimensions for axis 1z4Mismatching dimensions along axis 1: ({1, 2}|{2, 1})z.Got blocks\[0,1\]\.shape\[0\] == 1, expected 2z4Mismatching dimensions along axis 0: ({1, 2}|{2, 1})z"incompatible dimensions for axis 0r   r5  r6  )rT   rT   rI   r   )r=   rD   rT   )rE   rF   rT   r<   )r   r   r   ri   r   r   r  r  r  Temptyr   r6   r4   )
r8   r<  r  r  CDr   EZexcinfos
   &&        r(   test_block_creation&TestConstructUtils.test_block_creationG  s    1v1v&'sA3i sef)##% & 	[1&4)!45==?JfBHH-[1779aggi"8#$ggi."2 33:79	 	[1779aggi"8#$779aggi"8": ;;B79	 )##% & 	[1d)dAY!78@@BHM[1779acciik":#$ggi."2 33:79	 	[1779acciik":#$779aggi"8": ;;B79	 fBHH-1a&a&a&" # 	[4)aY!78@@BHM[13399;	":#$779a."2 33:79	 	[13399;	":#$779aggi"8": ;;B79	 88F#[4,088:HE[4)aY!78@@B	 1#<[4)aY!78@@B	 :&&'!qc
# 'GH:&&'!'')qwwyk23 ';<:&&'!'')qwwyk23 'MN:&&'!! 'GH:&&'!'')QWWY/01 'MN:&&'!'')QWWY/01 ';<- '&& '&& '&& '&& '& '&sH   5V:2)W)W"$W6(X
7(X:W	W	"W3	6X	
X	X-	c                F   \         P                  p^^.^^..^.^..r2\        V4      \        V4      rT\        V! RV.VR..RR7      \        4      '       g   Q h\        V! RV.VR..RR7      \        4      '       g   Q h\        V! WE..RR7      \        4      '       g   Q hR# )r=   Nr	  r   )r    r<  r	   r   r   )r8   blockFlGlFmGms   &     r(   test_block_return_type)TestConstructUtils.test_block_return_type  s    %%
 a&!QA3*BBBB%$b$Z 8GQQQQ%$b$Z 8GQQQQ%"
597CCCCr*   c                (   \         P                  p^^.^^..^.^..r2\        V4      \        V4      rT\        V4      \        V4      rv\	        V! Wg..RR7      \
        4      '       g   Q h\	        V! WE..RR7      \        4      '       g   Q h\	        V! RV.VR..RR7      \
        4      '       g   Q h\	        V! RV.VR..RR7      \
        4      '       g   Q h\	        V! RV.VR..RR7      \        4      '       g   Q h\	        V! RV.VR..RR7      \        4      '       g   Q h\	        V! Ww..RR7      \
        4      '       g   Q h\	        V! WW..RR7      \
        4      '       g   Q h\	        V! Wu..RR7      \
        4      '       g   Q h\	        V! WU..RR7      \        4      '       g   Q h\	        V! Wd..RR7      \
        4      '       g   Q h\	        V! WD..RR7      \        4      '       g   Q h\	        V! VP                  4       VP                  4       ..RR7      \
        4      '       g   Q h\	        V! VP                  4       VP                  4       ..RR7      \        4      '       g   Q h\	        V! VP                  4       VP                  4       ..RR7      \
        4      '       g   Q h\	        V! VP                  4       VP                  4       ..RR7      \        4      '       g   Q h\	        V! W7..RR7      \
        4      '       g   Q h\	        V! VP                  4       V..RR7      \
        4      '       g   Q h\	        V! VP                  4       V..RR7      \        4      '       g   Q h\	        V! WU..RR7      \        4      '       g   Q hR# )z2This can be removed after sparse matrix is removedr	  r   Nr
  )r    bmatr	   r   r   r   r   r  )r8   rP  rI  rJ  rK  rL  FaGas   &       r(   test_bmat_return_type(TestConstructUtils.test_bmat_return_type  s   ~~a&!QA3*BBBB2	"B$z%8'BBBB$z%8(CCCC$r
RJ7FPPPP$r
RJ7FPPPP$r
RJ7FQQQQ$r
RJ7FQQQQ $z%8'BBBB$z%8'BBBB$z%8'BBBB$z%8(CCCC$z%8'BBBB$z%8(CCCC $RXXZ 89%H'RRRR$RXXZ 89%H(SSSS$RXXZ 89%H'RRRR$RXXZ 89%H(SSSS $z%8'BBBB$R 01%@'JJJJ$R 01%@(KKKK$z%8(CCCCr*   z!Can't create large array for testc           	        \        R4       Rp\        \        P                  ! W3\        R7      4      pVP                  4       p\        P                  ! W#3^ RR7      p\        \        P                  ! \        P                  ! \        P                  ! VP                  4      V4      4      4       \        VP                  P                  \        P                   4       \        VP                  P                  \        P                   4       R# )z5test for indptr overflow when concatenating matrices i0u  i  r   F)axisreturn_spmatrixN)r   r   r   onesboolcopyr    _compressed_sparse_stackr   allequaldiffr  r   r  r%   r  )r8   r"   r  r  r@  s   &    r(   test_concatenate_int32_overflow2TestConstructUtils.test_concatenate_int32_overflow  s     	% bggqfD12FFH..vA?DF 	rxx 11567QYY__bhh/QXX^^RXX.r*   c                \   \        ^^.^^..4      p\        ^.^..4      p\        ^..4      p\        . RO. RO. RO. RO. RO.4      p\        P                  ! WV34      p\	        VP                  4       V4       VP                  ^ ,          P                  \        P                  8X  g   Q hR# )zbasic test for block_diag N)r=   rD   rT   rT   )rE   rF   rT   rT   )rT   rT   rG   rT   )rT   rT   rH   rT   )rT   rT   rT   rI   )
r   r   r    
block_diagr   ri   r%  r%   r   r  )r8   r  r  r@  r   ABCs   &     r(   test_block_diag_basic(TestConstructUtils.test_block_diag_basic  s    !uaUm$sA3i se,&&&&	( ) ""A!9-S[[]H-zz!}""bhh...r*   c                F   \        . RO. RO. RO.4      p\        ;QJ d    . R VP                   4       F  NK  	  5M! R VP                   4       4      Vn        \        P                  ! W.4      P                  ^ ,          P
                  \        P                  8X  g   Q hR# )r=   c              3   ^   "   T F#  qP                  \        P                  4      x  K%  	  R # 5ir   r  r  s   & r(   r  ?TestConstructUtils.test_block_diag_idx_dtype.<locals>.<genexpr>  r!  r"  Nr   r   )r   r$  r%  r    rb  r%   r   r  r&  s   & r(   test_block_diag_idx_dtype,TestConstructUtils.test_block_diag_idx_dtype  sk    y)Y785@qxx@55@qxx@@##QF+2215;;rxxGGGr*   c                   \        \        P                  ! ^^.^.4      P                  4       . RO. RO.4       \	        . RO4      p\	        ^ ^.4      p\        \        P                  ! W.4      P                  4       . RO. RO.4       R# )z(block_diag with scalar and 1d arguments N)rD   rE   rT   )rT   rT   rF   )r=   rT   rE   )r=   rT   rE   rT   rT   )rT   rT   rT   rT   rF   )r   r    rb  ri   r   r,  s   &  r(   test_block_diag_scalar_1d_args1TestConstructUtils.test_block_diag_scalar_1d_args  st     	9//!A
;CCE%y1	3 gqe9//7??A+_=	?r*   c                   \        \        P                  ! ^^ ..4      P                  4       \	        ^^ ..4      4       \        \        P                  ! ^^ ...4      P                  4       \	        ^^ ..4      4       \        \        P                  ! ^.^ ...4      P                  4       \	        ^.^ ..4      4       \        \        P                  ! ^.4      P                  4       \	        ^..4      4       R# )zblock_diag with one matrix N)r   r    rb  ri   r   r   s   &r(   test_block_diag_1$TestConstructUtils.test_block_diag_1  s    Y))Aq6(3;;=QF8_	&Y))QF8*5==?QF8_	&Y))QC!:,7??AQC!:&	( 	Y))1#.668QC5\	#r*   c                   \        . RO.RR7      p\        ^^..RR7      p\        \        P                  ! W.4      P	                  4       \        . RO. RO.4      4       \        ^.^.^..RR7      p\        ^.^..R	R7      p\        \        P                  ! W.4      P	                  4       \        ^^ .^^ .^^ .^ ^.^ ^..4      4       R# )
zblock_diag with sparse arrays r>   Nr=   rD   rE   )r=   rE   r   )r=   rD   rE   rT   rT   )rT   rT   rT   rF   rG   )rE   r=   r   )r   r   r    rb  ri   r   r,  s   &  r(   test_block_diag_sparse_arrays0TestConstructUtils.test_block_diag_sparse_arrays  s     yk01vhf-Y))1&199;O_=>	@ sQC!oV4sQCj/Y))1&199;QFQFQFQFQFCD	Fr*   c                   \        . RO.4      \        . RO.4      r!\        \        P                  ! W.4      \
        4      '       g   Q h\        \        P                  ! W.4      \
        4      '       g   Q h\        \        P                  ! W!.4      \
        4      '       g   Q h\        \        P                  ! W".4      \        4      '       g   Q hR# )r=   Nrr  )rD   rE   rF   )r   r
   r   r    rb  r   r   r,  s   &  r(   test_block_diag_return_type.TestConstructUtils.test_block_diag_return_type  s    )%z9+'>1)..v6@@@@)..v6@@@@)..v6@@@@)..v6AAAAr*   c                x  a \         \        3 EF'  o\        P                  \        P                  \        P
                  \        P                  \        P                  \        P                  \        P                  3 FQ  pS! ^^
RVR7      p\        VP                  V4       \        VP                  R
4       \        VP                  ^4       KS  	  S! ^^
RRR7      p\        VP                  \        P                  4       S! ^^
R\        P                  P                  R4      R7      p\!        VP"                  VP"                  4       \!        VP$                  VP$                  4       \!        VP&                  VP&                  4       R FR  pS! ^^
VR7      p\        VP                  \)        V\        P*                  ! VP                  4      ,          4      4       KT  	  R F$  pS! ^^
VR7      p\        VP,                  V4       K&  	  \/        \0        V3R l4       \/        \0        V3R l4       EK*  	  R	# )rG   皙?)r#   r%     )r#   r&   r#   r   c                     < S ! ^^
R4      # )rG   g? fs   r(   <lambda>9TestConstructUtils.test_random_sampling.<locals>.<lambda>0  s    a2smr*   c                     < S ! ^^
R4      # )rG   gr}  r~  s   r(   r  r  1  s    a2tnr*   N)rG   rL   )r   ry  r   rt   )r   r
  r	  lil)sprandr)   r   r  float64
longdoubler  r  	complex64
complex128r   r%   r?   nnzr   r   r   datarowcolr   prodr$   r   r6   )r8   tr   x1x2r#   r   r  s   &      @r(   test_random_sampling'TestConstructUtils.test_random_sampling  s|   !Ajj"**bmmhh",,GaS2QWWa(QWWg.QUUA&G 1b#40B2::.1b#299+@+@+FGBrww0rvvrvv.rvvrvv./aW-QUUC"''!''2B(B$CD 0 4aC(QXXs+ 4 *&;<*&<=5 "r*   r&   rz  c                :   \        ^
^R\        P                  VR7      p\        \        P                  ! \        P
                  ! ^ VP                  4      4      4       \        \        P                  ! \        P
                  ! VP                  ^4      4      4       R# rL   r   r#   r%   r&   N)r  r   r  r   r\  
less_equalr  r8   r&   r   s   && r(   	test_randTestConstructUtils.test_rand3  sZ     2r3bjjcBr}}Q/01r}}QVVQ/01r*   c                n   \        ^
^R\        P                  VR7      p\        \        P                  ! \        P
                  ! VP                  ^ 4      4      4       \        \        P                  ! \        P
                  ! ^VP                  4      4      4       \        ^
^R\        P                  VR7      p\        \        P                  ! \        P
                  ! VP                  ^ 4      4      4       \        \        P                  ! \        P
                  ! ^VP                  4      4      4       R# r  )r)   r   r  r   anylessr  r.   r  s   && r(   
test_randnTestConstructUtils.test_randn:  s    
 RS

Drwwqvvq)*+rwwq!&&)*+2r3bjjcJrwwqvvq)*+rwwq!&&)*+r*   c                    \         P                  ! ^
^
RR7       \         P                  ! RRR7       \         P                  ! RRR7       \         P                  ! RRR7       R# )rL   rn   r   NrL   rL   rL   rL   rL   rL   rL   rL   rL   rL   )r    r   r-   r   s   &r(   test_random_accept_str_dtype/TestConstructUtils.test_random_accept_str_dtypeF  sG     	Rs+xs3|3733?r*   c                ,   \         P                  ! RR\        ^ R7      pVP                  R8X  g   Q h\         P                  ! RR\        ^ R7      pVP                  R8X  g   Q h\         P                  ! RR\        ^ R7      pVP                  R8X  g   Q hR# )rT   g333333?)r#   r%   random_stater  N)rT   rF   r  r  )r    r-   r   r?   )r8   r   s   & r(   'test_random_array_maintains_array_shape:TestConstructUtils.test_random_array_maintains_array_shapeN  s    $$VSRSTyyF"""$$\3cqQyyL((($$%93c)*,yy0000r*   c                    \         P                  ! R4      pVP                  ^ ,          P                  \        P
                  8X  g   Q hR# )rL   Nr  )r    r-   r%  r%   r   r  )r8   r  s   & r(   test_random_array_idx_dtype.TestConstructUtils.test_random_array_idx_dtypeZ  s2    ""8,xx{  BHH,,,r*   c                d   \         P                  ! ^
^
RR7      p\        VP                  4       ^4       \         P                  ! R	RR7      p\        VP                  4       ^4       \        V\        4      '       g   Q hR
p\         P                  ! VRR7      p\        VP                  4       R4       \         P                  ! RRR7      p\        VP                  4       R4       \        V\        4      '       g   Q hRp\         P                  ! VRR7      p\        VP                  4       ^4       R# )rL   gx&1?r{  g(Rs?<i  gk) 3?i  gAy5:Nr  )        r  )rL   rL   rL   rL   )r  r  r  )r    r   r   count_nonzeror-   r   r   )r8   sparse_matrixsparse_arrayr?   s   &   r(   Etest_random_sparse_matrix_returns_correct_number_of_non_zero_elementsXTestConstructUtils.test_random_sparse_matrix_returns_correct_number_of_non_zero_elements^  s     "((R@]00226 --hG\//1"5,0000 --eZH\//1$7 !--.>P\//1$7,0000% --eZH\//1#6r*   r}  )M__name__
__module____qualname____firstlineno__r5   markparametrizer   r   r   r   r   r   r   r9   r   r	   r
   r   r   r   r@   rq   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-  r2  r7  r:  rP  r<  rE  rM  rS  xslowxfail_on_32bitr_  rd  ri  rl  ro  rs  rv  r  r   r   r   r  r  r  r  r  r  __static_attributes____classdictcell__)__classdict__s   @r(   r0   r0   )   s    [[U9i9i% 	 [[UJ
J
% &	&6LpL6\?6I&I64
F& [[Z)*<*<i>Q>Q)RSA TA [[UY]]I4G4G$HI! J!F [[UY]]I4G4G$HIA JA9 [[7a&1a&	4'a&1a&	4'q6Aq6
	T5): 
Q
Q;,z6"-01 [[YY(?@4 A4:D&V6. [[YY(?@! A!.V [[]Y^^Y=R=R,STK= UK=Z
D"DH [[[[ CD/ E // H
	?
#FB>< [[UT41F1Ft1L$MN2 O2 [[UT41F1Ft1L$MN	, O	,@
1-7 7r*   r0   c            	        \         P                  ! RR4      p \        \        P                  ! V RR7      P                  4       \         P                  ! V 4      4       \        \        P                  ! V ^RR7      P                  4       \         P                  ! V ^R7      4       \        \        P                  ! V ^RRR7      P                  4       \         P                  ! V ^R7      R,          4       \        P                  ! \        RR	7      ;_uu_ 4        \        P                  ! \         P                  ! RR4      ^RR
7       RRR4       R#   + '       g   i     R# ; i)z7Tests of diags_array that do not rely on diags wrapper.rt   r   Nr   rz   r%   r   r   z.*out of boundsr3   r>   r   )rw   rw   )r   r   r   r    r   ri   r   r5   r   r6   r   )r   s    r(   test_diags_arrayr  w  s    99S#Dy,,T>FFH"''RV-XdAT:BBDbggdVWFX dAV4HPPR
6" 
z):	;	;		#s+Qf= 
<	;	;	;s   /EE 	funcc                     ^.^^.^..p. ROpV ! WRR7      p\         P                  ! ^^.^^..4      p\        VP                  4       VRR7       R# )rE   Nr  Tstrictr`   )r   r   r   ri   r  rn   rz   r   r   s   &    r(   test_diags_intr    sV    
q!fqcAG q
.Cxx!Q!Q()Hs{{}ht<r*   c                 "   ^.^^.^..p. ROp\         P                  ! \        RR7      ;_uu_ 4        V ! WR7      pRRR4       \        P                  ! RR.RR..4      p\        XP                  4       VR	R
7       R#   + '       g   i     LJ; i)rE   zoutput has been cast tor3   r}   Nrt   r   r   r   Tr  r`   )r5   warnsFutureWarningr   r   r   ri   r  s   &    r(   test_diags_int_to_float64r    sv    
q!fqcAG
 
m+D	E	E1& 
Fxx#sc3Z01Hs{{}ht< 
F	Es   
A>>B	c                     \         P                  ! . R NRNRNRNRNRNRNRNRNR	NR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#N4      p \        V 4      P                  ^^4      p\        P
                  ! V^ ^4      p\        VR%,          P                  4       VR&,          P                  4       4       VP                  ^^^^4      p\        P
                  ! V^ ^4      p\        VP                  R'4       R$# )(      @Gz.@-!@      !@&1?ʡE@\( @Q@{G#@Pn@h|?!@!rh@jt@J+@zGa@!rh@ʡE@-@)\(@(\B#@+@uV@~j@"~@K7@
ףp=J#@Gz@Mb@}?5^#@羟/$@!rhm@-#@J+@Mb@ʡ@-?NrR   NNNrR   )rD   rD   rE   rE   )	r   r   r   reshaper    swapaxesr   ri   r?   )r   sX	sXswappedsXX
sXXswappeds        r(   test_swapaxesr    s   
 <% < < <s <E <5 <<<#<%*<,1<38<<< %<',<.3<5:< < < $< &+< -2< 49< 	< 	< !&	< (-	< /4	< 6;	<
 <
 <
 !&<
 (-<
 /4<
 6;< 	=A 
1		a	#B""2q!,I2&&("U)*;*;*=>
**Q1a
 C##CA.J!!<0r*   c                  H   ^ ^ .^^..^^.^ ^...p \         P                  ! ^ ^.^^ ..^ ^.^^...4      p\        V4      p\        P                  ! V^ ^4      p\        VP                  4       V 4       \        VP                  4       \         P                  ! V^ ^4      4       R# )rT   N)r   r   r   r    r  r   ri   tgtr   r  outs       r(   test_3d_swapaxesr    s    FQFq!fq!f-
.C
Aq6Aq6"aVaV$456A!A


Q1
%C$Aq! 45r*   r$   c                 v   \         P                  ! . RO. RO.4      p\        V4      P                  V 4      p\        P
                  ! V^^ 4      pVP                  R8X  g   Q hVP                  R8X  g   Q h\        VP                  4       \         P
                  ! V^^ 4      4       VP                  '       d   Q hR# )rD   r   NrD   rT   r=   rE   rG   rT   rE   rD   )r   r   r   asformatr    r  r$   r?   r   ri   has_canonical_formatr$   r  SAr  s   &   r(   test_sparse_format_swapaxesr    s    
)Y'(A	1		v	&B


RA
&C::99Aq! 45''''''r*   c            
      >   \        ^^ .^^..4      p \        \        RR7      ;_uu_ 4        \        P                  ! V R^ 4       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V ^ R4       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V ^^ 4       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V ^ ^4       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V R^4       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V ^R4       RRR4       \        \        P                  ! V ^ ^ 4      P                  4       V P                  4       4       \        ^4       Fj  p\        \        P                  ! W^V,
          4      P                  4       \        P                  ! W^,
          RV,
          4      P                  4       4       Kl  	  R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELz; i  + '       g   i     ELT; i  + '       g   i     EL.; i)rD   Invalid axisr3   N333333?rb   rR   )r   r   r6   r    r  r   ri   r   r  is     r(   test_axis_swapaxesr    s   Aq6Aq6"#A	z	8	81b!$ 
9	z	8	81a$ 
9	z	8	81a# 
9	z	8	81a# 
9	z	8	81c1% 
9	z	8	81a% 
9##Aq!,446		D1XqQU+335qa%a088:	
  
9	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8sG   H'%H;II#I7J'H8	;I	I 	#I4	7J	J	c                     \         P                  ! . R NRNRNRNRNRNRNRNRNR	NR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#N4      p V P                  ^^4      p\        V 4      P                  ^^4      p\        P
                  ! VR(R$R%7      pVP                  R(R&7      p\        VP                  4       VP                  4       4       \        VR),          P                  4       VR*,          P                  4       4       VP                  ^^^^4      pVP                  ^^^^4      p\        P
                  ! VR+R$R%7      p\        VP                  R,4       VP                  R+R&7      p\        VP                  R,4       \        VP                  4       VP                  4       4       \        VP                  4       \         P                  ! VR+R&7      4       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  TaxesrZ  r  Nr=   rT   rR   r  )rT   rD   r=   rE   )rE   rD   rD   rE   )
r   r   r  r   r    permute_dims	transposer   ri   r?   )	r   npxr  
sXpermutedsXtransposednpxxr  sXXpermutedsXXtransposeds	            r(   test_permute_dimsr    s   
 <% < < <s <E <5 <<<#<%*<,1<38<<< %<',<.3<5:< < < $< &+< -2< 49< 	< 	< !&	< (-	< /4	< 6;	<
 <
 <
 !&<
 (-<
 /4<
 6;< 	=A ))Aq/C	1		a	#B''dCJ<<V<,L##%|';';'=>B'')2e9+<+<+>?;;q!Q"D
**Q1a
 C((<dKK""L1MM|M4M$$l3$$&(=(=(?@$$&T(MNr*   c                  z   ^ .^.^ .^..^.^ .^.^...p \         P                  ! ^ ^.^^ .^ ^.^^...4      p\        V4      p\        P                  ! VRR7      p\        VP                  R4       \        VP                  4       V 4       \        VP                  4       \         P                  ! VRR7      4       R# )rT   r  N)rD   r=   rT   )rD   rF   r=   )	r   r   r   r    r  r   r?   ri   r  r  s       r(   test_3d_permute_dimsr    s    C!qcA31#sQC!!5
6C
Aq6Aq6Aq6Aq6234A!A

 
 
3CI&$QY ?@r*   c                      \        . RO. RO.4      p \        P                  ! V RR7      P                  RJ g   Q h\        P                  ! V ^ ^.R7      P                  RJ g   Q h\        P                  ! V ^^ .R7      P                  RJ g   Q hR# )rD   r  TFNr  r   rT   r=   )r   r    r  r  r  s    r(   "test_canonical_format_permute_dimsr     s|    9i()A!!!&1FF$NNN!!!1a&1FF$NNN!!!1a&1FF%OOOr*   c                  r   \        . RO. RO.4      p \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \
        RR7      ;_uu_ 4        \        P                  ! V ^^ 0R7       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \
        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \        P                  ! V RR	R
7      P                  4       V P                  RR	R
7      P                  4       4       \        \        P                  ! V ^^ .R	R
7      P                  4       V P                  ^^ .R	R
7      P                  4       4       \        \        P                  ! V RR	R
7      P                  4       V P                  RR	R
7      P                  4       4       \        \        P                  ! V RR	R
7      P                  4       V P                  4       4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELj; i  + '       g   i     ELD; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i)rD   zIncorrect number of axesr3   r  Nzduplicate value in axiszaxis must be an integer/tuplezaxis out of rangezaxis must be an integerTr  r  r   r   )r]   rT   )rT   r]   )rD   rT   )rT   rD   )r	  rT   r  r  )	r   r   r6   r    r  r   r   ri   r  r  s    r(   test_axis_permute_dimsr"    sw   9i()A	z)C	D	Dqy1 
E	z)B	C	Cqv. 
D	y(G	H	Hq1v. 
I 
z)<	=	=qw/ 
>	z)<	=	=qw/ 
>	z)<	=	=qv. 
>	z)<	=	=qv. 
>	y(A	B	Bqx0 
C qvD9AAC	d+335
 q1vD9AAC	!Qd+335 qt$7??A	d+335 qvD9AACQYY[? 
E	D	D	C	C	C	H	H	H 
>	=	=	=	=	=	=	=	=	=	=	=	B	B	Bs_   L%L-MMM)M=	NN%L*	-L>	M	M&	)M:	=N	N"	%N6	c                 v   \         P                  ! . RO. RO.4      p\        V4      P                  V 4      p\        P
                  ! VRR7      pVP                  R8X  g   Q hVP                  R8X  g   Q h\        VP                  4       \         P                  ! VRR7      4       VP                  '       d   Q hR# )rD   r  r   Nr  r   r  r  )r   r   r   r  r    r  r$   r?   r   ri   r  r  r  s   &   r(   test_sparse_format_permute_dimsr$  8  s    
)Y'(A	1		v	&B

 
 &
1C::99QV <=''''''r*   c                     \         P                  ! . R NRNRNRNRNRNRNRNRNR	NR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#N4      p V P                  ^^4      p\        V4      p\         P                  ! V^R$7      p\
        P                  ! V^R$7      p\        VR',          P                  4       VR'\         P                  R%3,          P                  4       4       \        VP                  4       V4       VP                  ^^^^4      pVP                  ^^^^4      p\         P                  ! V^R$7      p\
        P                  ! V^R$7      p\        VP                  R(4       \        VP                  4       V4       \         P                  ! VR)R$7      p\
        P                  ! VR)R$7      p\        VP                  R*4       \        VP                  4       V4       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  rV  r  NrR   )rE   rD   r=   rD   rE   r   )rE   rD   rD   r=   rE   )
r   r   r  r   expand_dimsr    r   ri   newaxisr?   )	r   r  r  npx_expanded
sXexpandedr  r  npxx_expandedsXXexpandeds	            r(   test_expand_dimsr-  E  s   
 <% < < <s <E <5 <<<#<%*<,1<38<<< %<',<.3<5:< < < $< &+< -2< 49< 	< 	< !&	< (-	< /4	< 6;	<
 <
 <
 !&<
 (-<
 /4<
 6;< 	=A ))Aq/C	3B>>#A.L&&r2JB'')2b"**a.?+@+H+H+JK##%|4;;q!Q"D
**Q1a
 CNN4a0M''!4K""O4$$&6NN4b1M''"5K""O4$$&6r*   c                      ^ ^ .^^...^^.^ ^....p \        ^ ^ .^^..^^.^ ^...4      p\        P                  ! V^R7      p\        VP	                  4       V 4       R# )rT   r&  N)r   r    r'  r   ri   )r  r  r  s      r(   test_3d_expand_dimsr/  c  sw    VaV!Q!Q 01
2CQFQF#q!fq!f%567A



*C$r*   c                    \         P                  ! ^^ .^^..4      p\        V4      P                  V 4      p\        P
                  ! V^R7      pVP                  R8X  g   Q hVP                  R8X  g   Q h\        VP                  4       \         P
                  ! V^R7      4       VP                  4       P                  VP                  8X  g   Q hR# )rD   r&  r   N)rD   r=   rD   )r   r   r   r  r    r'  r$   r?   r   ri   tocoor  r  s   &   r(   test_sparse_format_expand_dimsr2  j  s    
1a&1a&!"A	1		v	&B



+C::99	!!!qq 9:88:**c.F.FFFFr*   c            	         \        ^^ .^^..4      p \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V ^R7       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! V RR7       RRR4       \        ^4       F\  p\        \        P                  ! WR7      P                  4       \        P                  ! W^,
          R7      P                  4       4       K^  	  R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i)rD   r  r3   r&  Nr	  rb   )r   r   r6   r    r'  r   r   ri   r
  s     r(   test_axis_expand_dimsr4  v  s    Aq6Aq6"#A	z	8	8ab) 
9	z	8	8aa( 
9	z	8	8ac* 
91X!!!,446!!!a%088:	
  
9	8	8	8	8	8s#   D-%E E-D=	 E	E#	)r	  r
  r   r   r   r  dok)g{Gz?r   NN);__doc__numpyr   r   numpy.testingr   r   r   r   r5   r   r   scipy._lib._testutilsr   scipy.sparser	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    scipy.sparse._constructr   r  r   r)   r.   r0   r  r  r  r   r   r  r  r  r  r  r  r  r  r   r"  r$  r-  r/  r2  r4  r}  r*   r(   <module>r<     ss   /  < <  * 33 3 3 3 3 3<
IFK7 K7\>( )"7"7!IJ= K= )"7"7!IJ
= K
=1"6 >2( 3(
,O6	AP$N >2	( 3	(7<% >2G 3G
r*   