+
    /ir                        ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
Ht ^ RIHtHtHtHt ^ RIt^ RIHt ^ RIt^ RIt^ RIHu Ht R%R&.t]P6                  P8                  t]P<                  ! R]P                  P>                  ]3RR7      R	 4       t  ! R
 R4      t! ! R R]!4      t"Rt#Rt$Rt%Rt&Rt'Rt(Rt)Rt* ! R R4      t+Rt,Rt-Rt.Rt/Rt0Rt1 ! R R4      t2R  t3R! t4R" t5R# t6R$ t7R# )'    )mkdtempN)array	transposepi)assert_equalassert_allcloseassert_array_equalassert_array_almost_equal)raisesmoduleT)scopeparamsautousec                     V P                   P                  sV P                   P                  sV P                   P                  sR # N)parammminfommreadmmwrite)requests   &V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/io/tests/test_mmio.pyimplementationsr      s1    
 ]]!!F]]!!Fmm##G    c                   Z  a  ] tR t^%t o R tR tR tR t]P                  P                  R]4      R 4       t]P                  P                  R]4      R 4       tR tR	 t]P                  P                  R]4      R
 4       t]P                  P                  R]4      R 4       t]P                  P                  R]4      R 4       tR tR tR t]P                  P                  R]4      R 4       tR tR tR tR tR t]P                  P9                  ^
4      R 4       tR tR tRt V t!R# )TestMMIOArrayc                    \        \        \        P                  ! 4       4      R 7      V n        \
        P                  P                  V P                  R4      V n        R# suffixztestfile.mtxN	r   str	threadingget_native_idtmpdirospathjoinfnselfs   &r   setup_methodTestMMIOArray.setup_method&   6    S)@)@)B%CD'',,t{{N;r   c                F    \         P                  ! V P                  4       R # r   shutilrmtreer$   r)   s   &r   teardown_methodTestMMIOArray.teardown_method*       dkk"r   c                    \        V P                  V4       \        \        V P                  4      V4       \	        V P                  R R7      p\        W4       R# FspmatrixN)r   r(   r   r   r   r
   r*   ainfobs   &&& r   checkTestMMIOArray.check-   s:    VDGG_d+477U+!!'r   c                    \        V P                  V4       \        \        V P                  4      V4       \	        V P                  R R7      p\        W4       R# r6   )r   r(   r   r   r   r9   s   &&& r   check_exactTestMMIOArray.check_exact3   s:    VDGG_d+477U+Qr   typeval, dtypec           	     X    V P                  \        ^^.^^..VR7      ^^^RVR34       R# )   dtyper   generalNr@   r   r*   typevalrF   s   &&&r   test_simple_integer!TestMMIOArray.test_simple_integer9   7    AA/u=Q7GY?	Ar   c           	     \    \        RR.RR..VR7      pV P                  V^^^RVR34       R# )	   rE   r   rG   N)r   r@   )r*   rJ   rF   r:   s   &&& r   test_32bit_integer TestMMIOArray.test_32bit_integer>   s:    GW%'9:%HQ1gw	BCr   c                T   \        RR.RR..\        P                  R7      p\        P                  ! ^ 4      P                  ^8  dP   \
        \        P                  P                  P
                  8X  d#   \        \        \
        V P                  V4       R# V P                  VR4       R# )rO   rE   N                        rO   rO      r   integerrG   )r   npint64intpitemsizer   scipyio_mmioassert_raisesOverflowErrorr(   r@   r*   r:   s   & r   test_64bit_integer TestMMIOArray.test_64bit_integerC   sn    E5>GW#56bhhGGGAJ!#EHHNN4J4J)J-$''1=Q HIr   c                l    \        RR.RR..\        P                  R7      pV P                  VR4       R# )rO   rE   NrW   rX           )rO   rO   r\   r   unsigned-integerrG   )r   r^   uint64r@   rg   s   & r   test_64bit_unsigned_integer)TestMMIOArray.test_64bit_unsigned_integerJ   s1    E5>GW#56biiHMNr   c           	     X    V P                  \        ^ ^.^ ^ ..VR7      ^^^RVR34       R# r   rE   r   rG   NrH   rI   s   &&&r   "test_simple_upper_triangle_integer0TestMMIOArray.test_simple_upper_triangle_integerN   rM   r   c           	     X    V P                  \        ^ ^ .^^ ..VR7      ^^^RVR34       R# rr   rH   rI   s   &&&r   "test_simple_lower_triangle_integer0TestMMIOArray.test_simple_lower_triangle_integerS   rM   r   c           	     X    V P                  \        . RO. RO.VR7      ^^^RVR34       R# )rD   rE   r   rG   NrD   rO      r\         rH   rI   s   &&&r   test_simple_rectangular_integer-TestMMIOArray.test_simple_rectangular_integerX   s/    	95UCQ7GY?	Ar   c                <    V P                  ^^.R^.^^..R4       R# )rD         @N)rz   rO   r}   r   realrG   r=   r)   s   &r   test_simple_rectangular_float+TestMMIOArray.test_simple_rectangular_float]   s&    

QFS!Hq!f-8	:r   c                6    V P                  ^^.^R..R4       R# )rD         @NrO   rO   r\   r   r   rG   r   r)   s   &r   test_simple_floatTestMMIOArray.test_simple_floata   s     

QFQH%8	:r   c                6    V P                  ^^.^R..R4       R# )rD                 @N)rO   rO   r\   r   complexrG   r   r)   s   &r   test_simple_complex!TestMMIOArray.test_simple_complexe   s     

QFQG$;	=r   c           	     X    V P                  \        ^^.^^..VR7      ^^^RVR34       R# )rD   rE   r   	symmetricNrH   rI   s   &&&r   test_simple_symmetric_integer+TestMMIOArray.test_simple_symmetric_integeri   s7    AA/u=Q7G[A	Cr   c                6    V P                  ^ ^.R^ ..R4       R# )r   N)rO   rO   r\   r   r]   skew-symmetric)r@   r)   s   &r   "test_simple_skew_symmetric_integer0TestMMIOArray.test_simple_skew_symmetric_integern   s#    1a&2q'*H	Jr   c                J    V P                  \        ^ ^.RR..R4      R4       R# )r   g        fN       )rO   rO   r\   r   r   r   )r=   r   r)   s   &r    test_simple_skew_symmetric_float.TestMMIOArray.test_simple_skew_symmetric_floatr   s(    

51a&4+.4?	Ar   c                6    V P                  ^R.R^..R4       R# )rD   N       @      @       @      )rO   rO   r\   r   r   	hermitianr   r)   s   &r   test_simple_hermitian_complex+TestMMIOArray.test_simple_hermitian_complexv   s     

QIay)=	?r   c                    Rp\         P                  P                  V4      pV\        V4      ,           pV P                  VR4       R# )   Nr   r   )r   r   i  r   r   r   )r^   randomr   r=   r*   szr:   s   &  r   test_random_symmetric_float)TestMMIOArray.test_random_symmetric_floatz   s8    IIR 	!

1ABr   c                l    Rp\         P                  P                  V4      pV P                  VR4       R# )r   Nr      )r   r   ,  r   r   rG   )r^   r   r=   r   s   &  r   test_random_rectangular_float+TestMMIOArray.test_random_rectangular_float   s*    IIR 

1?@r   c                <   R p\         P                  ! V4      P                  R4      p\        P                  ! \
        RR7      ;_uu_ 4        \        P                  P                  \        P                  ! V4      4       RRR4       R#   + '       g   i     R# ; i)z            %%MatrixMarket matrix array real general
              3  3 999
            1.0
            2.0
            3.0
            4.0
            5.0
            6.0
            7.0
            8.0
            9.0
            asciiznot of length 2matchN
textwrapdedentencodepytestr   
ValueErrorrb   rc   r   BytesIOr*   stexts   &  r   &test_bad_number_of_array_header_fields4TestMMIOArray.test_bad_number_of_array_header_fields   s_     q!((1]]:->??HHOOBJJt,- @???   4B

B	c                h    V P                  \        ^^.R^c..\        P                  R7      R4       R# )rD   rE   Nr   r[   )r@   r   r^   int32r)   s   &r   #test_gh13634_non_skew_symmetric_int1TestMMIOArray.test_gh13634_non_skew_symmetric_int   s.    AR1BA	Cr   c                h    V P                  \        ^^.RR..\        P                  R7      R4       R# )rD        X@rE   Nr   r   )r=   r   r^   float32r)   s   &r   %test_gh13634_non_skew_symmetric_float3TestMMIOArray.test_gh13634_non_skew_symmetric_float   s+    

51a&2s),BJJ?8	:r   r(   r$   N)"__name__
__module____qualname____firstlineno__r+   r2   r=   r@   r   markparametrizeparametrize_argsrK   rT   rh   ro   rs   rv   r~   r   r   r   r   r   r   r   r   r   	fail_slowr   r   r   __static_attributes____classdictcell____classdict__s   @r   r   r   %   s    <#( [[-/?@A AA [[-/?@D ADJO [[-/?@A AA [[-/?@A AA [[-/?@A AA::= [[-/?@C ACJA?CA
 [[2. .$C: :r   r   c                     a  ] tR t^t o R tR tR tR t]P                  P                  R]4      R 4       tR tR tR	 tR
 t]P                  P                  R]4      R 4       t]P                  P                  R]4      R 4       t]P                  P                  R]4      R 4       tR tR tR 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 V t!R# )TestMMIOSparseCSRc                    \        \        \        P                  ! 4       4      R 7      V n        \
        P                  P                  V P                  R4      V n        R# r   r    r)   s   &r   r+   TestMMIOSparseCSR.setup_method   r-   r   c                F    \         P                  ! V P                  4       R # r   r/   r)   s   &r   r2   !TestMMIOSparseCSR.teardown_method   r4   r   c                    \        V P                  V4       \        \        V P                  4      V4       \	        V P                  R R7      p\        VP                  4       VP                  4       4       R# r6   )r   r(   r   r   r   r
   toarrayr9   s   &&& r   r=   TestMMIOSparseCSR.check   sH    VDGG_d+477U+!!))+qyy{;r   c                    \        V P                  V4       \        \        V P                  4      V4       \	        V P                  R R7      p\        VP                  4       VP                  4       4       R# r6   )r   r(   r   r   r   r   r9   s   &&& r   r@   TestMMIOSparseCSR.check_exact   sH    VDGG_d+477U+QYY[!))+.r   rB   c           	         V P                  \        P                  P                  ^^.^^..VR7      ^^^RVR34       R# )rD   rE   
coordinaterG   Nr@   rb   sparse	csr_arrayrI   s   &&&r   rK   %TestMMIOSparseCSR.test_simple_integer   D    //!Q!Q0@/NQ<)D	Fr   c                    \         P                  P                  \        RR.RR..\        P
                  R7      4      pV P                  VR4       R# )rO   rE   NrP   i  rR   rS   rO   rO   r\   r   r]   rG   )rb   r   r   r   r^   r   r@   rg   s   & r   rT   $TestMMIOSparseCSR.test_32bit_integer   sK    LL""57H*=+2G*<*>/1xx$9 : 	IJr   c                   \         P                  P                  \        RR.RR..\        P
                  R7      4      p\        P                  ! ^ 4      P                  ^8  dP   \        \         P                  P                  P                  8X  d#   \        \        \        V P                  V4       R# V P                  VR4       R# )rO   rE   N        rY   r   )rb   r   r   r   r^   r_   r`   ra   r   rc   rd   re   rf   r(   r@   rg   s   & r   rh   $TestMMIOSparseCSR.test_64bit_integer   s    LL""57G*<+3W*=*?/1xx$9 : GGAJ!#EHHNN4J4J)J-$''1=Q MNr   c                    \         P                  P                  \        RR.RR..\        P
                  R7      4      pV P                  VR4       R# )rO   rE   NrP   rQ   rR   rS   rO   rO   r\   r   rm   rG   )rb   r   r   r   r^   uint32r@   rg   s   & r   test_32bit_unsigned_integer-TestMMIOSparseCSR.test_32bit_unsigned_integer   K    LL""57G*<+2G*<*>/1yy$: ; 	RSr   c                    \         P                  P                  \        RR.RR..\        P
                  R7      4      pV P                  VR4       R# )rO   rE   Nr   rk   rl   r   )rb   r   r   r   r^   rn   r@   rg   s   & r   ro   -TestMMIOSparseCSR.test_64bit_unsigned_integer   r   r   c           	         V P                  \        P                  P                  ^ ^.^ ^ ..VR7      ^^^RVR34       R# r   rE   r   rG   Nr   rI   s   &&&r   rs   4TestMMIOSparseCSR.test_simple_upper_triangle_integer   r   r   c           	         V P                  \        P                  P                  ^ ^ .^^ ..VR7      ^^^RVR34       R# r   r   rI   s   &&&r   rv   4TestMMIOSparseCSR.test_simple_lower_triangle_integer   r   r   c           	         V P                  \        P                  P                  . RO. RO.VR7      ^^^RVR34       R# )rD   rE   r   rG   Nry   r{   r   rI   s   &&&r   r~   1TestMMIOSparseCSR.test_simple_rectangular_integer   s<    //I0Fe/TQ<)D	Fr   c                v    V P                  \        P                  P                  ^^.R^.^^..4      R4       R# )rD   r   N)rz   rO   r}   r   r   rG   r=   rb   r   r   r)   s   &r   r   /TestMMIOSparseCSR.test_simple_rectangular_float   s5    

5<<))Aq6C8aV*DE=	?r   c                p    V P                  \        P                  P                  ^^.^R..4      R4       R# )rD   r   NrO   rO   r\   r   r   rG   r  r)   s   &r   r   #TestMMIOSparseCSR.test_simple_float   s/    

5<<))Aq6As8*<==	?r   c                p    V P                  \        P                  P                  ^^.^R..4      R4       R# )rD   r   N)rO   rO   r\   r   r   rG   r  r)   s   &r   r   %TestMMIOSparseCSR.test_simple_complex   s0    

5<<))Aq6Ar7*;<@	Br   c           	         V P                  \        P                  P                  ^^.^^..VR7      ^^^RVR34       R# )rD   rE   r   r   Nr   rI   s   &&&r   r   /TestMMIOSparseCSR.test_simple_symmetric_integer   sD    //!Q!Q0@/NQ<+F	Hr   c                p    V P                  \        P                  P                  ^ ^.R^ ..4      R4       R# )r   Nr   )rO   rO   rD   r   r]   r   r   r)   s   &r   r   4TestMMIOSparseCSR.test_simple_skew_symmetric_integer   s2    //!Q"a0ABM	Or   c           	         V P                  \        P                  P                  \	        ^ ^.R^ ..R4      4      R4       R# )r   r   Nr   )rO   rO   rD   r   r   r   )r=   rb   r   r   r   r)   s   &r   r   2TestMMIOSparseCSR.test_simple_skew_symmetric_float   s7    

5<<))%!Q$0CS*IJD	Fr   c                p    V P                  \        P                  P                  ^R.R^..4      R4       R# )rD   Nr   r   )rO   rO   rz   r   r   r   r  r)   s   &r   r   /TestMMIOSparseCSR.test_simple_hermitian_complex   s0    

5<<))At9tQi*@AB	Dr   c                    Rp\         P                  P                  V4      pV\        V4      ,           p\        P                  P                  V4      pV P                  VR4       R# )r   Nr   )r   r      r   r   r   )r^   r   r   rb   r   r   r=   r   s   &  r   r   -TestMMIOSparseCSR.test_random_symmetric_float  sL    IIR 	!LL""1%

1FGr   c                    Rp\         P                  P                  V4      p\        P                  P	                  V4      pV P                  VR4       R# )r   Nr   )r   r   r   r   r   rG   )r^   r   rb   r   r   r=   r   s   &  r   r   /TestMMIOSparseCSR.test_random_rectangular_float  s>    IIR LL""1%

1DEr   c                   \         P                  P                  ^ R.RR..4      p\        P                  ! VP                  4       4      p^W!P                  4       ^ 8  &   R
p\        V P                  VRR7       \        \        V P                  4      V4       \        V P                  RR7      p\        W$P                  4       4       \         P                  P                  V4      '       d   Q h\        V P                  RR7      p\         P                  P                  V4      '       g   Q h\        V P                  4      p\         P                  P                  V4      '       g   Q hR	# )r   g      ?g      @g      @pattern)fieldFr7   TN)rO   rO   rz   r   r  rG   )rb   r   r   r^   
zeros_liker   r   r(   r   r   r   r
   
isspmatrix)r*   r:   pr;   r<   s   &    r   test_simple_pattern%TestMMIOSparseCSR.test_simple_pattern  s    LL""QHsCj#9:MM!))+&))+/<),VDGG_d+477U+!!YY[1<<**1----477T*||&&q))))477O||&&q))))r   c                    \         P                  P                  ^^.R^c..\        P                  R7      pV P                  VR4       R# )rD   rE   Nr   r   )rb   r   r   r^   r   r@   rg   s   & r   r   5TestMMIOSparseCSR.test_gh13634_non_skew_symmetric_int  s=    LL""QFRH#5RXX"FIJr   c                    \         P                  P                  ^^.RR..\        P                  R7      pV P                  VR4       R# )rD   r   rE   Nr   r  )rb   r   r   r^   r   r=   rg   s   & r   r   7TestMMIOSparseCSR.test_gh13634_non_skew_symmetric_float"  s;    LL""QFRI#6bjj"I

1@Ar   r   N)"r   r   r   r   r+   r2   r=   r@   r   r   r   r   rK   rT   rh   r   ro   rs   rv   r~   r   r   r   r   r   r   r   r   r   r  r   r   r   r   r   s   @r   r   r      sH    <#</ [[-/?@F AFKOTT [[-/?@F AF [[-/?@F AF [[-/?@F AF??B [[-/?@H AHOFDHF* KB Br   r   z]%%MatrixMarket matrix array integer general
2  2
2147483647
2147483646
2147483647
2147483646
z]%%MatrixMarket matrix coordinate integer symmetric
2  2  2
1  1  2147483647
2  2  2147483646
z%%MatrixMarket matrix array integer general
2  2
          2147483648
-9223372036854775806
         -2147483648
 9223372036854775807
z%%MatrixMarket matrix coordinate integer general
2  2  3
1  1           2147483648
1  2  9223372036854775807
2  2  9223372036854775807
z%%MatrixMarket matrix coordinate integer symmetric
2  2  3
1  1            2147483648
1  2  -9223372036854775807
2  2   9223372036854775807
z%%MatrixMarket matrix coordinate integer skew-symmetric
2  2  3
1  1            2147483648
1  2  -9223372036854775807
2  2   9223372036854775807
z%%MatrixMarket matrix array integer general
2  2
         2147483648
9223372036854775807
         2147483648
9223372036854775808
zq%%MatrixMarket matrix coordinate integer symmetric
2  2  2
1  1            2147483648
2  2  19223372036854775808
c                   b   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tRtV tR# )TestMMIOReadLargeIntegersii  c                    \        \        \        P                  ! 4       4      R 7      V n        \
        P                  P                  V P                  R4      V n        R# r   r    r)   s   &r   r+   &TestMMIOReadLargeIntegers.setup_methodj  r-   r   c                F    \         P                  ! V P                  4       R # r   r/   r)   s   &r   r2   )TestMMIOReadLargeIntegers.teardown_methodn  r4   r   c                T   \        V P                  R 4      ;_uu_ 4       pVP                  V4       RRR4       \        \	        V P                  4      V4       V'       dS   \
        P                  ! ^ 4      P                  ^8  d.   \        \        P                  P                  P                  8X  g	   V'       d"   \        \        \        V P                  4       R# \        V P                  RR7      pV'       g   VP                  4       p\        W(4       R#   + '       g   i     L; i)wNFr7   )openr(   writer   r   r^   r`   ra   r   rb   rc   rd   re   rf   r   r   )	r*   exampler:   r;   denseover32over64r   r<   s	   &&&&&&&  r   
check_read$TestMMIOReadLargeIntegers.check_readq  s    $''31GGG  VDGG_d+,,q0gAWAW6W-9tww/AIIK  s   DD'	c           	     ~    \        RR.RR..\        P                  R7      pV P                  \        VRRRRR7       R# )	rO   rE   TFr-  r.  r/  NrP   rQ   r[   )r   r^   r_   r0  _32bit_integer_dense_examplerg   s   & r   test_read_32bit_integer_dense7TestMMIOReadLargeIntegers.test_read_32bit_integer_dense~  sJ    GW%W%'.0hh84@"$$ 	 	&r   c           	     ~    \        R^ .^ R..\        P                  R7      pV P                  \        VRRRRR7       R# )rO   rE   Fr3  NrP   rQ   rO   rO   rO   r   r]   r   )r   r^   r_   r0  _32bit_integer_sparse_examplerg   s   & r   test_read_32bit_integer_sparse8TestMMIOReadLargeIntegers.test_read_32bit_integer_sparse  sH    GQ<w<!(*25G#$$ 	 	&r   c           	     ~    \        RR.RR	..\        P                  R7      pV P                  \        VR
RRRR7       R# )rO   rE   TFr3  NrW   i   r   rZ   r[   )r   r^   r_   r0  _64bit_integer_dense_examplerg   s   & r   test_read_64bit_integer_dense7TestMMIOReadLargeIntegers.test_read_64bit_integer_dense  sI    E6?g&(/1xx94@"#$ 	 	&r   c           	     ~    \        RR.^ R..\        P                  R7      pV P                  \        VRRRRR7       R# )	rO   rE   FTr3  NrW   rZ   )rO   rO   rz   r   r]   rG   )r   r^   r_   r0  %_64bit_integer_sparse_general_examplerg   s   & r   &test_read_64bit_integer_sparse_general@TestMMIOReadLargeIntegers.test_read_64bit_integer_sparse_general  sI    E7#w<!(*2=E##$ 	 	&r   c           	     ~    \        RR.RR..\        P                  R7      pV P                  \        VR	RRRR7       R# )
rO   rE   FTr3  NrW    rZ   )rO   rO   rz   r   r]   r   )r   r^   r_   r0  '_64bit_integer_sparse_symmetric_examplerg   s   & r   (test_read_64bit_integer_sparse_symmetricBTestMMIOReadLargeIntegers.test_read_64bit_integer_sparse_symmetric  sJ    E8$g&(/1xx9?G##$ 	 	&r   c           	     ~    \        RR.RR..\        P                  R7      pV P                  \        VR	RRRR7       R# )
rO   rE   FTr3  NrW   rE  rZ   )rO   rO   rz   r   r]   r   )r   r^   r_   r0  "_64bit_integer_sparse_skew_examplerg   s   & r   #test_read_64bit_integer_sparse_skew=TestMMIOReadLargeIntegers.test_read_64bit_integer_sparse_skew  sJ    E8$W%'.0hh8:L##$ 	 	&r   c           	     <    V P                  \        R RRRRR7       R # )NTr3  r[   )r0   _over64bit_integer_dense_exampler)   s   &r   !test_read_over64bit_integer_dense;TestMMIOReadLargeIntegers.test_read_over64bit_integer_dense  s%    8@"## 	 	%r   c           	     <    V P                  \        R RRRRR7       R # )NFTr3  r8  )r0  !_over64bit_integer_sparse_exampler)   s   &r   "test_read_over64bit_integer_sparse<TestMMIOReadLargeIntegers.test_read_over64bit_integer_sparse  s%    9G### 	 	%r   r   N)r   r   r   r   r+   r2   r0  r5  r:  r>  rB  rG  rK  rO  rS  r   r   r   s   @r   r#  r#  i  sA     <#&&&&&&%% %r   r#  a&  %%MatrixMarket matrix coordinate real general
%=================================================================================
%
% This ASCII file represents a sparse MxN matrix with L
% nonzeros in the following Matrix Market format:
%
% +----------------------------------------------+
% |%%MatrixMarket matrix coordinate real general | <--- header line
% |%                                             | <--+
% |% comments                                    |    |-- 0 or more comment lines
% |%                                             | <--+
% |    M  N  L                                   | <--- rows, columns, entries
% |    I1  J1  A(I1, J1)                         | <--+
% |    I2  J2  A(I2, J2)                         |    |
% |    I3  J3  A(I3, J3)                         |    |-- L lines
% |        . . .                                 |    |
% |    IL JL  A(IL, JL)                          | <--+
% +----------------------------------------------+
%
% Indices are 1-based, i.e. A(1,1) is the first element.
%
%=================================================================================
  5  5  8
    1     1   1.000e+00
    2     2   1.050e+01
    3     3   1.500e-02
    1     4   6.000e+00
    4     2   2.505e+02
    4     4  -2.800e+02
    4     5   3.332e+01
    5     5   1.200e+01
a   %%MatrixMarket matrix coordinate complex hermitian
  5  5  7
    1     1     1.0      0
    2     2    10.5      0
    4     2   250.5     22.22
    3     3     1.5e-2   0
    4     4    -2.8e2    0
    5     5    12.       0
    5     4     0       33.32
z%%MatrixMarket matrix coordinate real skew-symmetric
  5  5  7
    1     1     1.0
    2     2    10.5
    4     2   250.5
    3     3     1.5e-2
    4     4    -2.8e2
    5     5    12.
    5     4     0
z%%MatrixMarket matrix coordinate real symmetric
  5  5  7
    1     1     1.0
    2     2    10.5
    4     2   250.5
    3     3     1.5e-2
    4     4    -2.8e2
    5     5    12.
    5     4     8
z%%MatrixMarket matrix coordinate pattern symmetric
  5  5  7
    1     1
    2     2
    4     2
    3     3
    4     4
    5     5
    5     4
a  %%MatrixMarket  MATRIX    Coordinate    Real General

   5  5         8

1 1  1.0
2 2       10.5
3 3             1.5e-2
4 4                     -2.8E2
5 5                              12.
     1      4      6
     4      2      250.5
     4      5      33.32

c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tRtV tR# )TestMMIOCoordinatei0  c                    \        \        \        P                  ! 4       4      R 7      V n        \
        P                  P                  V P                  R4      V n        R# r   r    r)   s   &r   r+   TestMMIOCoordinate.setup_method1  r-   r   c                F    \         P                  ! V P                  4       R # r   r/   r)   s   &r   r2   "TestMMIOCoordinate.teardown_method5  r4   r   c                   \        V P                  R 4      pVP                  V4       VP                  4        \	        \        V P                  4      V4       \        V P                  RR7      P                  4       p\        W%4       R# )r)  Fr7   N)	r*  r(   r+  closer   r   r   r   r
   )r*   r,  r:   r;   r   r<   s   &&&&  r   r0  TestMMIOCoordinate.check_read8  sZ    #			VDGG_d+477U+335!!'r   c                V    . RO. RO. RO. RO. RO.pV P                  \        VR4       R# rD   N)rD   r   r   r}   r   )r         %@r   r   r   r   r   Q?r   r   )r        Po@r   )\@@r   r   r   r      r|   r|      r   r   rG   )r0  _general_examplerg   s   & r   test_read_general$TestMMIOCoordinate.test_read_general@  s/    '	
 	(!B	Dr   c                V    . RO. RO. RO. RO. RO.pV P                  \        VR4       R# )rD   NrD   r   r   r   r   )r   r`  r   y     Po@Q86r   ra  )r   y     Po@Q86@r   rd  y       )\@)r   r   r   y        )\@@rg  )r|   r|      r   r   r   )r0  _hermitian_examplerg   s   & r   test_read_hermitian&TestMMIOCoordinate.test_read_hermitianI  s/    ,2"	$
 	*AG	Ir   c                V    . RO. RO. RO. RO. RO.pV P                  \        VR4       R# )rD   Nrn  )r   r`  r   g     Por   ra  )r   rc  r   rd  r   rf  )r|   r|   ro  r   r   r   )r0  _skew_examplerg   s   & r   test_read_skew!TestMMIOCoordinate.test_read_skewR  s.    $#	
 	qI	Kr   c                V    . RO. RO. RO. RO. RO.pV P                  \        VR4       R# )rD   Nrn  )r   r`  r   rc  r   ra  )r   rc  r   rd  ri  )r   r   r   ri  rg  )r|   r|   ro  r   r   r   )r0  _symmetric_examplerg   s   & r   test_read_symmetric&TestMMIOCoordinate.test_read_symmetric[  s/    ##	
 	*AD	Fr   c                V    . RO. RO. RO. RO. RO.pV P                  \        VR4       R# )rD   Nrn  )r   rD   r   rD   r   )r   r   rD   r   r   )r   rD   r   rD   rD   )r   r   r   rD   rD   )r|   r|   ro  r   r  r   )r0  _symmetric_pattern_examplerg   s   & r   test_read_symmetric_pattern.TestMMIOCoordinate.test_read_symmetric_patternd  s/    	
 	2AG	Ir   c                V    . RO. RO. RO. RO. RO.pV P                  \        VR4       R# r_  )r0  _empty_lines_examplerg   s   & r   test_read_empty_lines(TestMMIOCoordinate.test_read_empty_linesm  s/    '	
 	,aB	Dr   c                .   \         P                  P                  R4      p\        V P                  V4       \        \        V P                  4      R4       VP                  4       p\        V P                  RR7      P                  4       p\        W!4       R# )
   Fr7   N)r  r  )r  r  r   r   r   r   )
rb   r   	coo_arrayr   r(   r   r   r   r   r
   )r*   r<   r:   s   &  r   test_empty_write_read(TestMMIOCoordinate.test_empty_write_readv  sh     LL""8,VDGG_C	EIIK477U+335!!'r   c                r    ^ RI p\        . RO4      p\        . R	O4      p\        . R
O4      p\        P                  P                  YBT33RR7      p\        T P                  T4       T P                   R2p\        T P                  R4      ;_uu_ 4       pTP                  TR4      pTP                  TP                  4       4       TP                  4        RRR4       \        TRR7      P                  4       p	\        YP                  4       4       R#   \         d     R# i ; i  + '       g   i     LX; i)r   Nshapez.bz2rbwbFr7   r   r   rD   rO   rz   rz   rz   r\   r   rz   rD   rO   rD   rz   r\   r\   g      ?g      @r`  rb  rc  g     qre  g      (@r|   r|   )bz2ImportErrorr   rb   r   r  r   r(   r*  BZ2Filer+  readr\  r   r   r
   )
r*   r  IJVr<   fn_bzip2f_inf_outr:   s
   &         r   test_bzip2_py3!TestMMIOCoordinate.test_bzip2_py3  s    	 *+*+EFLL""A1v;f"=ggYd#$''4  DKK$/EKK		$KKM !
 8e,446!!YY[1#  		 !    D AD&D#"D#&D6	c                r    ^ RI p\        . RO4      p\        . R	O4      p\        . R
O4      p\        P                  P                  YBT33RR7      p\        T P                  T4       T P                   R2p\        T P                  R4      ;_uu_ 4       pTP                  TR4      pTP                  TP                  4       4       TP                  4        RRR4       \        TRR7      P                  4       p	\        YP                  4       4       R#   \         d     R# i ; i  + '       g   i     LX; i)r   Nr  z.gzr  r  Fr7   r  r  r  r  )gzipr  r   rb   r   r  r   r(   r*  r+  r  r\  r   r   r
   )
r*   r  r  r  r  r<   fn_gzipr  r  r:   s
   &         r   test_gzip_py3 TestMMIOCoordinate.test_gzip_py3  s    	 *+*+EFLL""A1v;f"=WWIS/$''4  DIIgt,EKK		$KKM !
 7U+335!!YY[1#  		 ! r  c                   \        . RO4      p\        . RO4      p\        . RO4      p\        P                  P                  W1V33RR7      p\	        V P
                  V4       \        \        V P
                  4      R	4       VP                  4       p\        V P
                  RR7      P                  4       p\        WT4       R# )
r   r  Fr7   Nr  r  r  r  rh  r   rb   r   r  r   r(   r   r   r   r   r
   r*   r  r  r  r<   r:   s   &     r   test_real_write_read'TestMMIOCoordinate.test_real_write_read  s    *+*+EFLL""A1v;f"=VDGG_?	AIIK477U+335!!'r   c                   \        . RO4      p\        . RO4      p\        . RO4      p\        P                  P                  W1V33RR7      p\	        V P
                  V4       \        \        V P
                  4      R	4       VP                  4       p\        V P
                  RR7      P                  4       p\        WT4       R# )
r   r  Fr7   Nr  r  y      ?      @y      @       @y      %@?yQ?y     Po@        y     q      @y)\@@@y      (@?r  )r|   r|   ri  r   r   rG   r  r  s   &     r   test_complex_write_read*TestMMIOCoordinate.test_complex_write_read  s    *+*+ H I LL""A1v;f"=VDGG_B	DIIK477U+335!!'r   c                R   VR ,          pVP                  4        . p\        . RO4      p\        . RO4      p\        . RO4      pVP                  \        P                  P                  WdV33R	R7      4       \        . R
O4      pVP                  \        P                  P                  WdV33R	R7      4       V Fk  pVP                  4       pR FR  p	W)R,           ,          p
\        WP                  V	4      4       \        V
RR7      P                  4       p\        W4       KT  	  Km  	  R# )sparse_formatsr  z.mtxFr7   Nr  r  r  r  r  )csrcsccoo)mkdirr   appendrb   r   r  r   r   asformatr   r
   )r*   tmp_pathr$   matsr  r  r  matexpectedfmtfnameresults   &&          r   test_sparse_formats&TestMMIOCoordinate.test_sparse_formats  s    ,,*+*+EFELL**A1v;f*EF H IELL**A1v;f*EFC{{}H,,/||C016>>@)&;	 - r   c                |   \         .\        ^ RR4       Uu. uF  p^
V,          NK  	  up,           p\        ^^
4      pV F  pV F  p^
V,          ^,           p\        P                  P	                  Wf34      pWGV^,
          V^,
          3&   \        V P                  WuR7       \        P                  P                  V P                  RR7      p\        VP                  V^,
          .4       \        VP                  V^,
          .4       \        VP                  \        VRV R2 4      .4       K  	  K  	  R# u upi )	r   )	precisionFr7   .gNi)r   rangerb   r   	dok_arrayr   r(   rc   r   r	   rowcolr   datafloat)r*   itest_valuestest_precisionsvaluer  nAs   &       r   test_precision!TestMMIOCoordinate.test_precision  s    duQR/@A/@!b1gg/@AA2, E,		MA%LL**A62#!A#qs(8HHOODGGeO<"1551Q3%0"1551Q3%0%)A~1F)H(IJ - ! Bs   D9c                <   R p\         P                  ! V4      P                  R4      p\        P                  ! \
        RR7      ;_uu_ 4        \        P                  P                  \        P                  ! V4      4       RRR4       R#   + '       g   i     R# ; i)a              %%MatrixMarket matrix coordinate real general
              5  5  8 999
                1     1   1.000e+00
                2     2   1.050e+01
                3     3   1.500e-02
                1     4   6.000e+00
                4     2   2.505e+02
                4     4  -2.800e+02
                4     5   3.332e+01
                5     5   1.200e+01
            r   znot of length 3r   Nr   r   s   &  r   +test_bad_number_of_coordinate_header_fields>TestMMIOCoordinate.test_bad_number_of_coordinate_header_fields  s_     q!((1]]:->??HHOOBJJt,- @???r   r   N)r   r   r   r   r+   r2   r0  rk  rq  ru  ry  r}  r  r  r  r  r  r  r  r  r  r   r   r   s   @r   rV  rV  0  sf     <#(DIKFID
(2020(( <0K". .r   rV  c                  H    \        \        P                  ! R 4      RR7       R# )g%%MatrixMarket matrix coordinate complex symmetric
 1 1 1
1 1 -2.1846000000000e+02  0.0000000000000e+00Fr7   N)r   rc   StringIO r   r   test_gh11389r    s!    
2;; G H r   c                     . ROpV R,          p\        VR4      ;_uu_ 4       pVP                  V4       RRR4       \        VRR7       R#   + '       g   i     L; i)/ %%MatrixMarket matrix coordinate real general
ztest.mtxr)  NFr7   )r  z5 5 3
z2 3 1.0
z3 4 2.0
z3 5 3.0
)r*  
writelinesr   )r  lines	test_filer   s   &   r   test_gh18123r    sH    E
 :%I	i			U 

9u% 
	s   AA	c                     \        \        P                  ! R 4      RR7      pV R,          pV R,          p\        W!4       \        VRR7       R# )r  Fr7   test_mtxztest_mtx.mtxN)r   rc   r  r   )r  r:   test_writefiletest_readfiles   &   r   test_mtx_appendr    sK    r{{ K L 	A 
*N.MN
=5)r   c                      ^ RI p \        V R4      '       g   \        P                  ! R4       R#  T P                  ^R7      ;_uu_ 4        \        \        P                  ^4       RRR4       T P                  ^RR7      ;_uu_ 4        \        \        P                  ^4       RRR4       R#   \         d    \        P                  ! R4        R# i ; i  + '       g   i     Lx; i  + '       g   i     R# ; i)r   Nregisterzthreadpoolctl too oldzno threadpoolctl)limitsrb   )r  user_api)	threadpoolctlhasattrr   skipr  threadpool_limitsr   fmmPARALLELISM)r  s    r   test_threadpoolctlr  )  s    }j11KK/0 2 
	(	(	(	2	2S__a( 
3 
	(	(G	(	D	DS__a( 
E	D  &' 
3	2 
E	D	Ds)   ,B. C	C).!CCC&	)C:	c                      \        \        \        P                  ! 4       4      R 7      p \        P
                  P                  V R4      p\        \        \        V4       R# )r   znot_exist_test_file.mtxN)
r   r!   r"   r#   r%   r&   r'   re   FileNotFoundErrorr   )r$   wrong_fns     r   test_gh21999_file_not_existr  :  s<    C	 7 7 9:;Fww||F$=>H#VX6r   )r]   int)rm   uint)8tempfiler   r%   rc   r0   r"   r   numpyr^   r   r   r   numpy.testingr   r   r	   r
   r   r   re   scipy.sparserb   scipy.io._mmioscipy.io._fast_matrix_market_fast_matrix_marketr  r   r   thread_unsafe
pytestmarkfixturerd   r   r   r   r4  r9  r=  rA  rF  rJ  rN  rR  r#  rj  rp  rt  rx  r|  r  rV  r  r  r  r  r  r  r   r   <module>r     sO    	 	     & &J J  *   * * '02  [[&&
 h'<dK$ L$y: y:xCB CBL  !   ) %+ '& "$  % !_% _%D  D
 

 
  "Y. Y.x	&*)"7r   