+
    /i[[                         R t Rt. ROt^ RIt^ RIt^RIHt ^RIH	t	H
t
Ht ^RIHt ^RIHtHtHtHtHtHtHtHt  ! R	 R
]	]]4      tR t ! R R]]
4      t ! R R]]4      tR# )zDictionary Of Keys based matrixzrestructuredtext en	dok_array
dok_matrixN)spmatrix)_spbasesparrayissparse)
IndexMixin)isdensegetdtypeisshape	isintlikeisscalarlikeupcastupcast_scalarcheck_shapec                   p  a a ] tR t^t oRtR<tR=RR/R lltR tR>R ltR>R lt	]
P                  P                  ]n        ]
P                  P                  ]	n        R tR	 tR>R
 ltR tR tR tR tR tR tR tR tR tR tR tR?R l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+R( t,R) t-R* t.R+ t/R, t0R- t1R. t2R/ t3R0 t4R1 t5R@V 3R2 llt6RAR3 lt7]
Pn                  P                  ]7n        R4 t8]
Pp                  P                  ]8n        ]9RBR5 l4       t:RCR6 lt;]
Pv                  P                  ];n        RCR7 lt<]
Px                  P                  ]<n        RCR8 lt=]
Pz                  P                  ]=n        R9 t>]
P|                  P                  ]>n        RDR: lt?R;t@VtAV ;tB# )E	_dok_basedokNmaxprintc                   \         P                  ! WVR 7       \        V\        4      '       dW   \	        WP
                  R7      '       d;   \        WP
                  R7      V n        / V n        \        V\        R7      V n        R# \        V4      '       d   VP                  V P                  8X  d   V'       d   VP                  4       MTpMVP                  4       pVe   VP!                  VRR7      pVP                  V n        \        VP"                  V P
                  R7      V n        \        VP                  4      V n        R#  \$        P&                  ! V4      pTP,                  ^8  d   \/        RTP,                   R24      hTP,                  ^8X  d`   Te   TP!                  TRR7      p\1        T4       UUu/ uF  w  rxT^ 8w  g   K  YxbK  	  uppT n        \        TP                  4      T n        MLT P3                  YTR	7      P                  4       p	T	P                  T n        \        T	P                  4      T n        \        TP"                  T P
                  R7      T n        R#   \(         d   p\+        R4      ThRp?ii ; iu uppi )
)r   allow_nd)defaultNFcopyzInvalid input format.zDOK arrays don't yet support zD input.shapedtype)r   __init__
isinstancetupler   	_allow_ndr   _shape_dictr
   floatr   r   formatr   todokastyper   npasarray	Exception	TypeErrorndim
ValueError	enumerate_coo_container)
selfarg1r   r   r   r   eivds
   &&&&&$    O/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/sparse/_dok.pyr   _dok_base.__init__   s   h7dE""wtnn'M'M%d^^DDKDJ!%7DJd^^{{dkk)&*tyy{zz| {{5u{5DJ%djj4>>JDK!$**-DJ@zz$' yy1} #@8!TUUyyA~$;;u5;9D/8Itq!q&dadI
%djj1
'''GMMOWW
%agg.
%djj4>>JDK  @ 78a?@ Js$   I+ =J
J
+J6JJc                   \        V\        4      '       d   VP                  4       pMTpV EF  w  r4\        V4      '       d   V3M
\	        V4      p\        V4      V P                  8w  d   \        RV R24      h\        ;QJ d/    R \        WPP                  4       4       F  '       d   K   RM$	  RM ! R \        WPP                  4       4       4      '       d   K  \        WPP                  4       FO  w  rg\        V4      '       g   \        RV 24      hV^ 8  d   \        RV R24      hWg8  g   KB  \        R	V R
24      h	  EK  	  V P                  P                  V4       R# )zUpdate values from a dict, sparse dok or iterable of 2-tuples like .items()

Keys of the input must be sequences of nonnegative integers less than the shape
for each axis.
Index ! length needs to match self.shapec              3   x   "   T F0  w  r\        V4      ;'       d    ^ Tu;8*  ;'       d    V8  Mu x  K2  	  R# 5i    N)r   ).0idxmax_idxs   &  r6   	<genexpr>#_dok_base.update.<locals>.<genexpr>K   s5      $:LC #551#5#5g#55$:s   :::FTz&integer keys required for update. Got znegative index z not allowed in updatezindex z is too large for self.shapeN)r   dictitemsr   r    lenr,   
IndexErrorallzipr   r#   update)r0   valinputskeyvalueindexr?   r@   s   &&      r6   rI   _dok_base.update<   s'    c4  YY[FF JC'nnSF%*E5zTYY& 6#.O!PQQ3 $'zz$:333 $'zz$:  
 %(zz$:LC$S>>(+QRUQV)WXXQw(?3%?U)VWW~(6#6R)STT %; !" 	

&!    c                J    Ve   \        R4      h\        V P                  4      # )Nz7_getnnz over an axis is not implemented for DOK format.)NotImplementedErrorrE   r#   r0   axiss   &&r6   _getnnz_dok_base._getnnzZ   s(    %I  4::rP   c                `    Ve   \        R4      h\        R V P                  4        4       4      # )Nz=count_nonzero over an axis is not implemented for DOK format.c              3   *   "   T F	  q^ 8g  x  K  	  R# 5ir<    )r>   xs   & r6   rA   *_dok_base.count_nonzero.<locals>.<genexpr>f   s     1=a6=s   )rR   sumvaluesrS   s   &&r6   count_nonzero_dok_base.count_nonzeroa   s1    %O  14;;=111rP   c                ,    \        V P                  4      # N)rE   r#   r0   s   &r6   __len___dok_base.__len__k   s    4::rP   c                    WP                   9   # ra   r#   r0   rL   s   &&r6   __contains___dok_base.__contains__n   s    jj  rP   c               8    V P                   P                  W4      # ra   )r#   
setdefault)r0   rL   r   s   """r6   rk   _dok_base.setdefaultq   s    zz$$S22rP   c                    V P                   V R # ra   rf   rg   s   ""r6   __delitem___dok_base.__delitem__t   s    JJsOrP   c                6    V P                   P                  4       # ra   )r#   clearrb   s   &r6   rq   _dok_base.clearw       zz!!rP   c               6    V P                   P                  ! V!  # ra   )r#   pop)r0   argss   "*r6   ru   _dok_base.popz   s    zz~~t$$rP   c                    \        R 4      h)z*reversed is not defined for dok_array type)r+   rb   s   &r6   __reversed___dok_base.__reversed__}   s    DEErP   c                x    \        V 4      P                   R \        V4      P                   2p\        RV 24      hz and z unsupported operand type for |: type__name__r+   r0   other
type_namess   && r6   __or___dok_base.__or__   ;    T
++,E$u+2F2F1GH
::,GHHrP   c                x    \        V 4      P                   R \        V4      P                   2p\        RV 24      hr|   r}   r   s   && r6   __ror___dok_base.__ror__   r   rP   c                x    \        V 4      P                   R \        V4      P                   2p\        RV 24      hr|   r}   r   s   && r6   __ior___dok_base.__ior__   r   rP   c                6    V P                   P                  4       # ra   )r#   popitemrb   s   &r6   r   _dok_base.popitem   s    zz!!##rP   c                6    V P                   P                  4       # ra   )r#   rD   rb   s   &r6   rD   _dok_base.items   rs   rP   c                6    V P                   P                  4       # ra   )r#   keysrb   s   &r6   r   _dok_base.keys   s    zz  rP   c                6    V P                   P                  4       # ra   )r#   r]   rb   s   &r6   r]   _dok_base.values   s    zz  ""rP   c                V   WP                   9   d   V P                   V,          # \        V4      '       d   V P                  ^8X  d   V3pV P                  \        V4      8w  d   \	        RV R24      h V F  p\        V4      '       d   K  Q h	  \        ;QJ d'    . R \        YP                  4       4       F  NK  	  5M ! R \        YP                  4       4       4      p\        ;QJ d/    R \        YP                  4       4       F  '       g   K   RM$	  RM ! R \        YP                  4       4       4      '       d   \	        R	4      hT P                  ^8X  d
   T^ ,          pT P                   P                  Y4      #   \
        \        \        3 d   p\	        R4      ThRp?ii ; i)
z>This provides dict.get method functionality with type checkingr9   r:   z%Index must be or consist of integers.Nc              3   H   "   T F  w  rV^ 8  d	   W,           MTx  K  	  R# 5ir<   rY   r>   r3   Ms   &  r6   rA    _dok_base.get.<locals>.<genexpr>   s!     K6JdaQUAE)6Js    "c              3   H   "   T F  w  rV^ 8  ;'       g    W8  x  K  	  R# 5ir<   rY   r   s   &  r6   rA   r      s"     @+?41q1u+?s   ""TFzIndex out of bounds.)r#   r   r,   rE   rF   AssertionErrorr+   r-   r    rH   r   anyget)r0   rL   r   r3   r2   s   &&&  r6   r   _dok_base.get   s8   **::c?"S>>dii1n&C99C vcU*KLMM	M ||#|  eKc#zz6JKeeKc#zz6JKK3@3sJJ+?@333@3sJJ+?@@@34499>a&Czz~~c++ 	:6 	MDE1L	Ms   3F F F(F##F(c                j    V P                   P                  WP                  P                  ^ 4      4      # r=   r#   r   r   r~   )r0   r?   s   &&r6   _get_int_dok_base._get_int   s"    zz~~c::??1#566rP   c                    \        VP                  V P                  ^ ,          4      !  pV P                  \	        V4      4      # r   )rangeindicesr   
_get_arraylist)r0   r?   i_ranges   && r6   
_get_slice_dok_base._get_slice   s0    TZZ]34tG}--rP   c                   \         P                  ! V4      pVP                  ^ 8X  d`   V P                  P	                  \        V4      V P                  P                  ^ 4      4      p\         P                  ! W P                  R7      # V P                  VP                  V P                  R7      pVP                  4        Uu. uF  q@P                  P	                  V^ 4      NK   	  ppV'       d   \        VP                  4      ^8X  d/   \        V4       F  w  rFV'       g   K  WcP                  V&   K  	  V# \         P                  ! \         P                  ! \        V4      4      VP                  4      p\        V4      ^8X  d
   V^ ,          M\!        V!  p\!        WuRR7       F  w  rFV'       g   K  WcP                  V&   K  	  V# u upi )r=   )styper   T)strict)r(   r)   r,   r#   r   intr   r~   array_dok_containerr   ravelrE   r.   unravel_indexarangerH   )r0   r?   rJ   new_dokr3   dok_valsr4   new_idxs   &&      r6   r   _dok_base._get_array   sB   jjo88q=**..S4::??1+=>C88Czz22%%ciitzz%B25))+>+QJJNN1a(+>399~"%h/DAq+,a( 0  **299S]+CSYYO(+G(9'!*sG}$?DAq+,a( @  ?s    $Gc                n    V P                   P                  W3V P                  P                  ^ 4      4      # r   r   r0   rowcols   &&&r6   _get_intXint_dok_base._get_intXint   s&    zz~~sj$**//!*<==rP   c                F    V P                  \        W^,           4      V4      #    _get_sliceXsliceslicer   s   &&&r6   _get_intXslice_dok_base._get_intXslice   s    $$U3a%8#>>rP   c                F    V P                  V\        W"^,           4      4      # r   r   r   s   &&&r6   _get_sliceXint_dok_base._get_sliceXint   s    $$S%1W*=>>rP   c                &   VP                  V P                  ^ ,          4      w  r4pVP                  V P                  ^,          4      w  rgp\        W4V4      p	\        WgV4      p
\        V	4      \        V
4      3p\        V 4      ^V^ ,          ,          V^,          ,          8  d   V P	                  W4      # V P                  WP                  R7      pV P                  4        F  p\        \        V^ ,          4      V,
          V4      w  rV^ 8w  g   V^ 8  g   W^ ,          8  d   KE  \        \        V^,          4      V,
          V4      w  ppV^ 8w  g   V^ 8  g   VV^,          8  d   K  V P                  V,          VP                  VV3&   K  	  V# )r=   r   )r   r   r   rE   _get_columnXarrayr   r   r   divmodr   r#   )r0   r   r   	row_startrow_stoprow_step	col_startcol_stopcol_step	row_range	col_ranger   newdokrL   r3   rijrjs   &&&               r6   r   _dok_base._get_sliceXslice   sD   (+DJJqM(B%	X(+DJJqM(B%	X)x8	)x8	YY0 t9E!HuQx//)))??$$U**$=99;C3s1v;2H=EAQw!a%1a=3s1v;2H=EArQw!a%1a=!%CFLLA  rP   c                D    V P                  V.VP                  4       4      # ra   )r   r   r   s   &&&r6   _get_intXarray_dok_base._get_intXarray   s    %%seSYY[99rP   c                    V P                  VP                  4       V.4      pVP                  ^8  d   VP                  VP                  4      # V# r   )r   r   r,   reshaper   )r0   r   r   ress   &&& r6   _get_arrayXint_dok_base._get_arrayXint   s?    $$SYY[3%888a<;;syy))
rP   c                    \        \        VP                  V P                  ^ ,          4      !  4      pV P	                  W4      # r   r   r   r   r   r   r   s   &&&r6   _get_sliceXarray_dok_base._get_sliceXarray   3    5#++djjm456%%c//rP   c                    \        \        VP                  V P                  ^,          4      !  4      pV P	                  W4      # r   r   r   s   &&&r6   _get_arrayXslice_dok_base._get_arrayXslice   r   rP   c                $   V P                  \        V4      \        V4      3V P                  R 7      p\        V4       FO  w  rE\        V4       F;  w  rgV P                  P                  WW3^ 4      pV'       g   K,  WP                  WF3&   K=  	  KQ  	  V# r   )r   rE   r   r.   r#   r   )	r0   r   r   r   r3   rr   cr4   s	   &&&      r6   r   _dok_base._get_columnXarray   sx    $$c#hC%9$LcNDA!#JJNNA61-1)*LL& ' #
 rP   c                   \        \        P                  \        P                  ! W4      4      w  r4V P	                  VP
                  V P                  R 7      p\        P                  ! \        VP
                  ^ ,          4      \        VP
                  ^,          4      4       FE  pV P                  P                  W6,          WF,          3^ 4      pV'       g   K7  WuP                  V&   KG  	  V# r   )mapr(   
atleast_2dbroadcast_arraysr   r   r   	itertoolsproductr   r#   r   )r0   r   r   r3   r   r   rL   r4   s   &&&     r6   _get_arrayXarray_dok_base._get_arrayXarray  s    2==""5"5c"?@$$QWWDJJ$?$$U1771:%6aggaj8IJC

/3Aq$%S! K rP   c                t    V'       d   W P                   V&   R # WP                   9   d   V P                   V R # R # ra   rf   )r0   r?   rZ   s   &&&r6   _set_int_dok_base._set_int  s*    JJsOJJ

3 rP   c                   VP                  4       pVP                  4       p\        V4      \        V4      8w  dP   \        V4      ^8X  d5   \        P                  ! \        V4      V^ ,          V P                  R7      pM\        R4      h\        W44       F<  w  rVV'       d   W`P                  V&   K  WPP                  9   g   K/  V P                  V K>  	  R# )r   r   z*Need len(index)==len(data) or len(data)==1N)r   rE   r(   fullr   r-   rH   r#   )r0   r?   rZ   idx_setx_setr3   r4   s   &&&    r6   
_set_array_dok_base._set_array  s    ))+	w<3u:%5zQGeAhdjjIKLL'DA !

1jjJJqM	 (rP   c                z    W3pV'       d   W0P                   V&   R # W@P                   9   d   V P                   V R # R # ra   rf   )r0   r   r   rZ   rL   s   &&&& r6   _set_intXint_dok_base._set_intXint&  s1    jJJsOJJ

3 rP   c                   \        \        \        VP                  4       4      4      p\        \        \        VP                  4       4      4      pVP                  4       pV P                  P                  \        \        W4      V4      4       \        P                  ! V^ 8H  4      ^ ,           F:  pW,          W$,          3pV P                  V,          ^ 8X  g   K-  V P                  V K<  	  R# r<   )	r   r   r   r   r#   rI   rH   r(   nonzero)r0   r   r   rZ   r3   rL   s   &&&&  r6   _set_arrayXarray_dok_base._set_arrayXarray-  s    3sCIIK()3sCIIK()GGI

#c#mQ/0AF#A&&A636"Czz#!#JJsO	 'rP   c                  a \        V4      '       d   \        V P                  V4      pV P                  V P                  VR 7      o\
        P                  ! V P                   Uu. uF  p\        V4      NK  	  up!   F5  pV P                  P                  V^ 4      V,           pV'       g   K0  VSV&   K7  	  S# \        V4      '       Edd   VP                  V P                  8w  d   \        R4      h\        V P                  VP                  4      pV P                  V P                  VR 7      oV P                  P                  4       Sn        VP                  R8X  d   VP                  4       pMpVP!                  4       pV P"                  ^8X  d)   \%        VP&                  ^ ,          VP(                  4      pM'\%        \%        VP&                  !  VP(                  4      p\*        P,                  ! RR7      ;_uu_ 4        SP                  P/                  V3R lV 4       4       RRR4       S# \1        V4      '       d   V P3                  4       V,           oS# \4        # u upi   + '       g   i     S# ; i)r   z Matrix dimensions are not equal.r   ignore)overc              3   L   <"   T F  w  rVSV,          V,           3x  K  	  R # 5ira   rY   )r>   kr4   news   &  r6   rA   $_dok_base.__add__.<locals>.<genexpr>Q  s      EWTQ!SVaZWs   !$N)r   r   r   r   r   r   r   r   r#   r   r   r-   r   r   r%   rD   tocoor,   rH   coordsdatar(   errstaterI   r	   todenseNotImplemented)r0   r   	res_dtyper5   rL   aijo_itemsr  s   &&     @r6   __add___dok_base.__add__9  s   %djj%8I%%djj	%BC ((TZZ*HZ58Z*HIjjnnS!,u43"CH J0 
) e__{{djj( !CDDtzz5;;7I%%djj	%BC

)CI||u$++-99>!%,,q/5::>G!#u||"4ejjAG(++		   EW EE , 
	 U^^,,.5(C 
 "!/ +I$ ,+ 
s   $I=&I""I3	c                    W,           # ra   rY   r0   r   s   &&r6   __radd___dok_base.__radd__X  s
    |rP   c                    V P                   P                  R 8X  d   \        R4      hV P                  V P                  V P                   R7      pVP
                  P                  R V P                  4        4       4       V# )bz2Negating a sparse boolean matrix is not supported.r   c              3   .   "   T F  w  rW) 3x  K  	  R # 5ira   rY   )r>   r  r4   s   &  r6   rA   $_dok_base.__neg__.<locals>.<genexpr>a  s     :\TQ!R\s   )r   kindrR   r   r   r#   rI   rD   r0   r  s   & r6   __neg___dok_base.__neg__[  sd    ::??c!%D  !!$**DJJ!?		:TZZ\::
rP   c                   a \        V P                  S4      pV P                  V P                  VR 7      pVP                  P                  V3R lV P                  4        4       4       V# )r   c              3   <   <"   T F  w  rWS,          3x  K  	  R # 5ira   rY   r>   r  r4   r   s   &  r6   rA   (_dok_base._mul_scalar.<locals>.<genexpr>h  s     B\TQ1%i.\   )r   r   r   r   r#   rI   rD   r0   r   r  r  s   &f  r6   _mul_scalar_dok_base._mul_scalard  sO    !$**e4	!!$**I!>		BTZZ\BC
rP   c                  a a \        S P                  SP                  4      pS P                  ^8X  d   \        S4      '       d   SP                  R8X  d'   S P                  4       SP                  4       ,          pM6S P                  4       SP                  4       P                  ^ ,          ,          pV! \        VV 3R lV 4       4      4      # \        S4      '       d*   V! \        V3R lS P                  4        4       4      4      # \        # \        P                  ! S P                  ^ ,          VR7      pS P                  4        F*  w  w  rVpWE;;,          VSV,          ,          ,          uu&   K,  	  V# )r   r   c              3   z   <"   T F0  pSP                   V,          SP                   V,          ,          x  K2  	  R # 5ira   rf   )r>   r  r   r0   s   & r6   rA   +_dok_base._matmul_vector.<locals>.<genexpr>u  s)     $RTTZZ]U[[^%C%CTs   8;c              3   H   <"   T F  w  rSV,          V,          x  K  	  R # 5ira   rY   r)  s   &  r6   rA   r1  w  s     $KldaU1X\\l   "r   )r   r   r,   r   r%   r   r  r  r\   r	   rD   r  r(   zerosr   )r0   r   r  r   resultr3   r   r4   s   ff      r6   _matmul_vector_dok_base._matmul_vectork  s    4::u{{3	 99><<5(99;5D99;)=)=a)@@D $RT$R!RSS $Kdjjl$K!KLL%% $**Q-y9IFQAIU1X%I &rP   c                  a \        V P                  SP                  4      pV P                  ^8X  d.   \        V3R lV P                  P                  4        4       4      # V P                  ^ ,          pSP                  ^8X  d   V3MVSP                  ^,          3p\        P                  ! WBR7      pV P                  4        F*  w  w  rgpWV;;,          VSV,          ,          ,          uu&   K,  	  V# )r   c              3   H   <"   T F  w  rVSV,          ,          x  K  	  R # 5ira   rY   )r>   r   r4   r   s   &  r6   rA   0_dok_base._matmul_multivector.<locals>.<genexpr>  s     C0Bq58||0Br3  r   )	r   r   r,   r\   r#   rD   r   r(   r4  )	r0   r   result_dtyper   	new_shaper5  r3   r   r4   s	   &f       r6   _matmul_multivector_dok_base._matmul_multivector  s    djj%++699>C

0@0@0BCCC JJqM!JJ!OQD!U[[^1D	)8IFQAIU1X%I &rP   c                   a \        S4      '       d6   V P                  P                  V3R  lV P                  4        4       4       V # \        # )c              3   <   <"   T F  w  rWS,          3x  K  	  R # 5ira   rY   r)  s   &  r6   rA   %_dok_base.__imul__.<locals>.<genexpr>       Fqe)nr+  r   r#   rI   rD   r  r  s   &fr6   __imul___dok_base.__imul__  7    JJFFFKrP   c                $  a \        S4      '       di   \        V P                  S4      pV P                  V P                  VR 7      pVP
                  P                  V3R lV P                  4        4       4       V# V P                  4       S,          # )r   c              3   <   <"   T F  w  rWS,          3x  K  	  R # 5ira   rY   r)  s   &  r6   rA   (_dok_base.__truediv__.<locals>.<genexpr>  rB  r+  )	r   r   r   r   r   r#   rI   rD   tocsrr,  s   &f  r6   __truediv___dok_base.__truediv__  sk    %djj%8I%%djj	%BCIIFFGJzz|e##rP   c                   a \        S4      '       d6   V P                  P                  V3R  lV P                  4        4       4       V # \        # )c              3   <   <"   T F  w  rWS,          3x  K  	  R # 5ira   rY   r)  s   &  r6   rA   )_dok_base.__itruediv__.<locals>.<genexpr>  rB  r+  rC  r  s   &fr6   __itruediv___dok_base.__itruediv__  rF  rP   c                ,    \         P                  V 4      # ra   )rC   
__reduce__rb   s   &r6   rS  _dok_base.__reduce__  s     t$$rP   c                Z   < V P                   ^8X  d   \        SV `	  V4      # \        R4      h)   z diagonal requires two dimensions)r,   superdiagonalr-   )r0   r  	__class__s   &&r6   rX  _dok_base.diagonal  s*    99>7#A&&;<<rP   c                .   V P                   ^8X  d   V P                  4       # Ve   VR8w  d   \        R4      hV P                  w  r4V P	                  WC3V P
                  VR7      pVP                  P                  R V P                  4        4       4       V# )r   zvSparse arrays/matrices do not support an 'axes' parameter because swapping dimensions is the only logical permutation.)r   r   c              3   6   "   T F  w  w  rq2V3V3x  K  	  R # 5ira   rY   )r>   leftrightrJ   s   &   r6   rA   &_dok_base.transpose.<locals>.<genexpr>  s     V3E=D#4=#.s   )r   r=   )	r,   r   r-   r   r   r   r#   rI   rD   )r0   axesr   r   Nr  s   &&&   r6   	transpose_dok_base.transpose  s    99>99;>  zz!!1&

!F		VVW
rP   c                    V P                  V P                  V P                  R 7      pVP                  P	                  V P                  4       V# r   )r   r   r   r#   rI   r$  s   & r6   r   _dok_base.copy  s:    !!$**DJJ!?		$
rP   c               N   \         P                  W4      p\        \        \	        V4      4      \
        4      '       d<   \
        ;QJ d    . R  \        V!   4       F  NK  	  5M! R  \        V!   4       4      pM\        V4      ^,           3pV ! V\        V4      R7      pW5n	        V# )c              3   F   "   T F  p\        V4      ^,           x  K  	  R# 5i)r   N)max)r>   r?   s   & r6   rA   %_dok_base.fromkeys.<locals>.<genexpr>  s     <)3#c(Q,,)s   !r   )
rC   fromkeysr   nextiterr    rH   rh  r~   r#   )clsiterablerM   tmpr   r5  s   """   r6   rj  _dok_base.fromkeys  st    mmH,d49ou--E<#s)<EE<#s)<<EX\OEU$u+.rP   c                d  aa V P                   oS^ 8X  d(   V P                  V P                  V P                  R7      # V P	                  \        V P                  4      R7      o\        P                  ! V P                  4       V P                  SR7      pV P                  ^8  d   \        V P                  4       !  MV P                  4       3p\        ;QJ d    . VV3R lV 4       F  NK  	  5M! VV3R lV 4       4      pV P                  W$3V P                  V P                  R7      pRVn        V# )r=   r   )maxvalr   countc              3   V   <"   T F  p\         P                  ! VSSR 7      x  K   	  R# 5i)rs  N)r(   fromiter)r>   ix	idx_dtypennzs   & r6   rA   "_dok_base.tocoo.<locals>.<genexpr>  s!     RTrr{{2YcBBTs   &)r   T)ry  r/   r   r   _get_index_dtyperh  r(   rv  r]   r,   rH   r   r    has_canonical_format)r0   r   r  indsr  Arx  ry  s   &&    @@r6   r  _dok_base.tocoo  s    hh!8&&tzz&DD))TZZ)A	{{4;;=

#F$(IIMsDIIK 		~RTRRTRRdjj

S!%rP   c                6    V'       d   V P                  4       # V # ra   r   r0   r   s   &&r6   r&   _dok_base.todok  s    99;rP   c                ~    V P                   ^8X  d   \        R4      hV P                  RR7      P                  VR7      # )r   z%tocsr() not valid for 1d sparse arrayFr   )r,   rR   r  tocscr  s   &&r6   r  _dok_base.tocsc  s8    99>%&MNNzzuz%+++66rP   c                   \        WP                  R 7      p\        V4      \        V P                  4      8w  d   \        hV P
                  ^8X  dC   VR,          p\        V P                  4       F  pW28  g   K  V P                  V K  	  Wn        R# Vw  rBV P                  w  rVWE8  g   W&8  d?   \        V P                  4       4       F!  w  r7W48  g	   Wr8  g   K  V P                  W73 K#  	  Wn        R# )r   N)
r   r!   rE   r   rR   r,   r   r#   r"   r   )r0   r   newNr3   newMr   ra  r   s   &*      r6   resize_dok_base.resize  s    ENN;u:TZZ(%%99>9D$**%9

1 &  K
zz8txTYY[)9	

14( * rP   c                |   \         P                  ! V4      pV P                  V8w  d}   V P                  V P                  VR 7      p\         P                  ! \        V P                  P                  4       4      VR 7      p\        \        V P                  V4      4      Vn        V# V'       d   V P                  4       # V # r   )r(   r   r   r   r   r   r#   r]   rC   rH   r   )r0   r   castingr   r5  r  s   &&&&  r6   r'   _dok_base.astype  s    ::((5(AF88D!2!2!45UCDDJJ 56FLM99;rP   )r#   r"   r   )r   rV  )NNFra   )g        r   )NFr   )F)unsafeT)Cr   
__module____qualname____firstlineno___formatr!   r   rI   rU   r^   r   __doc__rc   rh   rk   rn   rq   ru   ry   r   r   r   r   rD   r   r]   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r%  r-  r6  r=  rD  rK  rP  rS  rX  rb  r   classmethodrj  r  r&   r  r  r'   __static_attributes____classdictcell____classcell__)rY  __classdict__s   @@r6   r   r      s    GI%KT %KN"<2 oo--GO#1199M!3"%FIII$"!#,*7.*>??.:00		 " 
$>,$%=
   ))11I
 <<''DL  MM))EM
 MM))EM7
 MM))EM. ^^++FN	 	rP   r   c                "    \        V \        4      # )a  Is `x` of dok_array type?

Parameters
----------
x
    object to check for being a dok matrix

Returns
-------
bool
    True if `x` is a dok matrix, False otherwise

Examples
--------
>>> from scipy.sparse import dok_array, dok_matrix, coo_matrix, isspmatrix_dok
>>> isspmatrix_dok(dok_matrix([[5]]))
True
>>> isspmatrix_dok(dok_array([[5]]))
False
>>> isspmatrix_dok(coo_matrix([[5]]))
False
)r   r   )rZ   s   &r6   isspmatrix_dokr    s    . a$$rP   c                       ] tR tRtRtRtR# )r   i2  a  
Dictionary Of Keys based sparse array.

This is an efficient structure for constructing sparse
arrays incrementally.

This can be instantiated in several ways:
    dok_array(D)
        where D is a 2-D ndarray

    dok_array(S)
        with another sparse array or matrix S (equivalent to S.todok())

    dok_array((M,N), [dtype])
        create the array with initial shape (M,N)
        dtype is optional, defaulting to dtype='d'

Attributes
----------
dtype : dtype
    Data type of the array
shape : 2-tuple
    Shape of the array
ndim : int
    Number of dimensions (this is always 2)
nnz
    Number of nonzero elements
size
T

Notes
-----

Sparse arrays can be used in arithmetic operations: they support
addition, subtraction, multiplication, division, and matrix power.

- Allows for efficient O(1) access of individual elements.
- Duplicates are not allowed.
- Can be efficiently converted to a coo_array once constructed.

Examples
--------
>>> import numpy as np
>>> from scipy.sparse import dok_array
>>> S = dok_array((5, 5), dtype=np.float32)
>>> for i in range(5):
...     for j in range(5):
...         S[i, j] = i + j    # Update element

rY   N)r   r  r  r  r  r  rY   rP   r6   r   r   2  s    1rP   c                   \   a  ] tR tRt o RtR tR t]! ]]R7      tR t	R t
R tR	 tR
tV tR# )r   ig  a  
Dictionary Of Keys based sparse matrix.

This is an efficient structure for constructing sparse
matrices incrementally.

This can be instantiated in several ways:
    dok_matrix(D)
        where D is a 2-D ndarray

    dok_matrix(S)
        with another sparse array or matrix S (equivalent to S.todok())

    dok_matrix((M,N), [dtype])
        create the matrix with initial shape (M,N)
        dtype is optional, defaulting to dtype='d'

Attributes
----------
dtype : dtype
    Data type of the matrix
shape : 2-tuple
    Shape of the matrix
ndim : int
    Number of dimensions (this is always 2)
nnz
    Number of nonzero elements
size
T

Notes
-----

Sparse matrices can be used in arithmetic operations: they support
addition, subtraction, multiplication, division, and matrix power.

- Allows for efficient O(1) access of individual elements.
- Duplicates are not allowed.
- Can be efficiently converted to a coo_matrix once constructed.

Examples
--------
>>> import numpy as np
>>> from scipy.sparse import dok_matrix
>>> S = dok_matrix((5, 5), dtype=np.float32)
>>> for i in range(5):
...     for j in range(5):
...         S[i, j] = i + j    # Update element

c                    V P                  VR R7      P                  V P                  4      pVP                  V n        R# )Fr   N)r   asformatr%   __dict__)r0   r   
new_matrixs   && r6   	set_shapedok_matrix.set_shape  s0    \\%e\4==dkkJ
"++rP   c                    V P                   # )zGet shape of a sparse matrix.)r"   rb   s   &r6   	get_shapedok_matrix.get_shape  s    {{rP   )fgetfsetc                6    V P                   P                  4       # ra   )r#   ry   rb   s   &r6   ry   dok_matrix.__reversed__  s    zz&&((rP   c                    \        V\        4      '       d   V P                  VP                  ,          # V P                  V,          # ra   r   r   r#   r  s   &&r6   r   dok_matrix.__or__  1    eY''::++zzE!!rP   c                    \        V\        4      '       d   V P                  VP                  ,          # V P                  V,          # ra   r  r  s   &&r6   r   dok_matrix.__ror__  r  rP   c                    \        V\        4      '       d&   V ;P                  VP                  ,          un        V # V ;P                  V,          un        V # ra   r  r  s   &&r6   r   dok_matrix.__ior__  s=    eY''JJ%++%J  JJ%JrP   )r  N)r   r  r  r  r  r  r  propertyr   ry   r   r   r   r  r  )r  s   @r6   r   r   g  s<     1f, ))4E)"
"
 rP   )r   r   r  )r  __docformat____all__r   numpyr(   _matrixr   _baser   r   r   _indexr   _sputilsr	   r
   r   r   r   r   r   r   rC   r   r  r   r   rY   rP   r6   <module>r     sj    %%
7    - - ; ; ;CT CL%62	7 2jP9 PrP   