+
    /iZ                     $   R t . t^ RIHt ^ RIt^ RIt^ RIHtH	t	 ^RI
HtHtHtHt ^RI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HtHtHtHtH t H!t!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/H0t0H1t1H2t2  ! R
 R]]]&4      t3RR lt4R t5R# )z>Base class for sparse matrix formats using compressed storage.)warnN)_prune_arraycopy_if_needed)_spbaseissparsesparraySparseEfficiencyWarning)_data_matrix_minmax_mixin)_sparsetools)get_csr_submatrixcsr_sample_offsetscsr_todensecsr_sample_valuescsr_row_indexcsr_row_slicecsr_column_index1csr_column_index2csr_diagonal	expandptrcsr_has_canonical_formatcsr_eliminate_zeroscsr_sum_duplicatescsr_has_sorted_indicescsr_sort_indicescsr_matmat_maxnnz
csr_matmat)
IndexMixin)upcastupcast_char	to_nativeisshapegetdtype	isintlikedowncast_intp_indexget_sum_dtypecheck_shapeget_index_dtypebroadcast_shapesc                   ~  a  ] tR t^t o RtR9RR/R lltR:R lt]P                  P                  ]n        R:R lt]P                  P                  ]n        R;R lt	R t
R	 tR
 tR tR tR tR tR tR<R lt]P$                  P                  ]n        R=R lt]P&                  P                  ]n        R:R ltR tR tR tR tR tR>R ltR tR>R ltR9R ltR tR tR t R t!R  t"R! t#R" t$R# t%R;R$ lt&]PL                  P                  ]&n        R?R% lt']PN                  P                  ]'n        R& t(])V 3R' lR( l4       t*]*PV                  V 3R) lR* l4       t*R+ t,])V 3R, lR- l4       t-]-PV                  V 3R. lR/ l4       t-R0 t.R1 t/R2 t0R3 t1]Pb                  P                  ]1n        R;R4 lt2R5 t3R6 t4R>R7 lt5R8t6V t7R# )@
_cs_matrixzQ
base array/matrix class for compressed row- and column-oriented arrays/matrices
Nmaxprintc               
   \         P                  ! WVR 7       \        V4      '       d   VP                  V P                  8X  d   V'       d   VP	                  4       pMVP                  V P                  4      pVP                  VP                  VP                  VP                  3w  V n        V n        V n        V n	        EM\        V\        4      '       Ed   \        WP                  R7      '       d   \        WP                  R7      V n	        V P                  V P                   4      w  rgV P#                  \%        V P&                  4      R7      p\(        P*                  ! ^ \-        V\.        R7      4      V n        \(        P*                  ! ^ V4      V n        \(        P*                  ! V^,           VR7      V n        EM\1        V4      ^8X  d\   V P3                  WVR7      p	V	P5                  V P                  4      p
V
w  V n        V n        V n        V n	        V P7                  4        EM\1        V4      ^8X  d   Vw  rpRpVe   ^ V9  d   \%        V4      pV P#                  W3VRR7      pV'       g   \8        p\(        P:                  ! WVR	7      V n        \(        P:                  ! WVR	7      V n        \(        P:                  ! WVR	7      V n        M\=        R
V P>                  P@                   RV 24      h \(        PB                  ! V4      p\        T \F        4      '       d<   TPH                  ^8w  d+   T P                  R8X  d   \=        RTPH                   R24      hTPH                  ^8  d   \=        RTPH                   R24      hT P3                  YR7      p	T	P5                  T P                  4      p
T
w  T n        T n        T n        T n	        Ve   \        W P                  R7      V n	        MxV P&                  fk    \1        V P                  4      ^,
          pV P                  P%                  4       ^,           p\        T P                  Yg34      T P                  R7      T n	        Ve.   \-        V4      pV P                  PK                  VRR7      V n        V PM                  RR7       R#   \D         d,   p\=        R
T P>                  P@                   RT 24      ThRp?ii ; i  \D         d   p\=        R4      ThRp?ii ; i))r+   allow_ndmaxval)defaultdtypeshaper3   NT)r0   check_contentscopyr3   zunrecognized z constructor input: csczCSC arrays don't support zD input. Use 2DzCSR arrays don't yet support zD.z!unable to infer matrix dimensionsFr8   
full_check)'r	   __init__r   formatr8   asformatindptrindicesdata_shape
isinstancetupler!   	_allow_ndr&   _swap_shape_as_2d_get_index_dtypemaxr5   npzerosr"   floatlen_coo_container_coo_to_compressedsum_duplicatesr   array
ValueError	__class____name__asarray	Exceptionr   ndimastypecheck_format)selfarg1r5   r3   r8   r+   MN	idx_dtypecooarraysrB   rA   r@   r0   enewdtypes   &&&&&$           V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/sparse/_compressed.pyr=   _cs_matrix.__init__   s   d8<D>>{{dkk)dyy{}}T[[1T\\499dkkA=DKty$+ e$$tnn55 *$Hzz$"3"34 !11TZZ1I	HHQ(FG	!xx95 hhq1uI>t9>--du-MC 33DJJ?FHNEDKty$+'')Y!^.2+TF "F(Qe^!$U $ 5 5w6G7=?C !6 !EI  -#%88Gi#PDL"$((6I"NDK " FDI$}T^^5L5L4M N;;?&&B C C
Fzz$' $((TYY!^u@T #<TYYK!WXXyy1} #@2!NOO%%d%8C++DJJ7F@F=DKty$+ %ennEDKZZM$q(LL$$&* &djj!&84>>RDKH		(((>DIU+;  F =1H1H0I J77;f"> ?DEFF(  M !DE1LMs0   8R.  =S' .S$9&SS$'T2S>>Tc                   Vf   \        V P                  R,          4      # V P                  ^8X  d/   VR9   d   \        V P                  R,          4      # \        R4      hV^ 8  d
   V^,          pV P	                  V^V,
          34      w  rV P	                  V P
                  4      w  r#V^ 8X  d,   \        P                  ! \        V P                  4      VR7      # V^8X  d!   \        P                  ! V P                  4      # \        R4      h)Naxis out of bounds	minlength    rj   )intr@   rX   rS   rG   r5   rK   bincountr$   rA   diff)r[   axis_r^   s   &&  rd   _getnnz_cs_matrix._getnnzv   s    <t{{2''YY!^w4;;r?++122ax	jj$D!12GD::djj)DAqy{{#6t||#DPQRRwwt{{++122    c                   V P                  4        Vf!   \        P                  ! V P                  4      # V P                  ^8X  d3   VR9  d   \        R4      h\        P                  ! V P                  4      # V^ 8  d
   V^,          pV P                  V^V,
          34      w  rV^ 8X  d   V P                  V P                  4      w  r#V P                  ^ 8g  pVP                  4       '       d   V P                  MV P                  V,          p\        P                  ! \        V4      VR7      # V^8X  d   V P                  P                  4       '       d!   \        P                  ! V P                  4      # \        P                  ! V P                  4      p\        P                   ! V UUu. uF'  w  rx\        P                  ! V P                  Wx 4      NK)  	  upp4      # \        R4      hu uppi )Nrg   rh   rk   )rQ   rK   count_nonzerorB   rX   rS   rG   r5   allrA   rn   r$   ro   r@   	itertoolspairwiserR   )	r[   rp   rq   r^   maskidxpairsijs	   &&       rd   rv   _cs_matrix.count_nonzero   sd   <##DII..99>7" !566##DII..!8AID**dAH-.19::djj)DA99>D"&((**$,,$,,t2DC;;2371EEQYyy}}wwt{{++&&t{{3E88%P%$!R--diin=%PQQ122 Qs   )-G)
c                   V P                   P                  P                  R8w  d0   \        RV P                   P                  P                   R2^R7       V P
                  P                  P                  R8w  d0   \        RV P
                  P                  P                   R2^R7       V P                  P                  V P
                  P                  V P                   P                  3 F  pV^8w  g   K  \        R4      h	  V P                  V P                  4      w  r4\        V P                   4      V^,           8w  d,   \        R\        V P                   4       RV^,            24      hV P                   ^ ,          ^ 8w  d   \        R	4      h\        V P
                  4      \        V P                  4      8w  d   \        R
4      hV P                   R,          \        V P
                  4      8  d   \        R4      hV P                  4        V'       Ed8   V P                  ^ 8  d   V P
                  P                  4       V8  d   \        RV 24      hV P
                  P                  4       ^ 8  d   \        R4      h\         P"                  ! V P                   4      P                  4       ^ 8  d   \        R4      hV P%                  V P                   V P
                  34      p\         P&                  ! V P                   VR7      V n         \         P&                  ! V P
                  VR7      V n        \)        V P                  4      V n        R# R# )a  Check whether the array/matrix respects the CSR or CSC format.

Parameters
----------
full_check : bool, optional
    If `True`, run rigorous check, scanning arrays for valid values.
    Note that activating those check might copy arrays for casting,
    modifying indices and index pointers' inplace.
    If `False`, run basic checks on attributes. O(1) operations.
    Default is `True`.
r}   z$indptr array has non-integer dtype ()
stacklevelz%indices array has non-integer dtype (z'data, indices, and indptr should be 1-Dzindex pointer size z should be z!index pointer should start with 0z*indices and data should have the same sizezQLast value of index pointer should be less than the size of index and data arrayszindices must be < zindices must be >= 0z(indptr must be a non-decreasing sequencer2   Nrj   )r@   r3   kindr   namerA   rB   rX   rS   rG   rH   rN   prunennzrJ   minrK   ro   rI   rV   r    )r[   r<   xr]   r^   r_   s   &&    rd   rZ   _cs_matrix.check_format   s|    ;;!!S(78I8I8N8N7OqQ<<""c)89K9K9P9P8QQRS ))..$,,"3"3T[[5E5EFAAv !JKK G
 zz$++,A%23t{{3C2DKPQTUPUwWXXKKNa@AA TYY/IJJKKOc$,,// A B B 	

:xx!|<<##%*$'9!%=>><<##%)$%;<<774;;'++-1$%OPP--t{{DLL.IJI**T[[	BDK::dll)DDL!$)),DI rt   c                    V P                  4        V P                  V! V P                  V4      RR7      pVP                  4        V# )z}Scalar version of self._binopt, for cases in which no new nonzeros
are added. Produces a new sparse array in canonical form.
Tr:   )rQ   
_with_datarB   eliminate_zeros)r[   otheropress   &&& rd   _scalar_binopt_cs_matrix._scalar_binopt   s>     	oobE2o>
rt   c                \   VP                   V P                   8w  d'   \        R V P                    RVP                    R24      h\        V P                  P                  VP                  P                  4      pV P                  R4      ^ ,          p\        P                  ! WVRR7      pVP                  P                  '       d   TMVP                  pV P                  V P                  4      w  rg\        WgV P                  V P                  V P                  V4       V P!                  VRR7      # )zIncompatible shapes ( and r   CFT)r3   orderr8   Fr:   )r5   rS   r   r3   charrG   rK   rR   flagsc_contiguousTrH   r   r@   rA   rB   
_container)r[   r   r3   r   resultyr]   r^   s   &&      rd   
_add_dense_cs_matrix._add_dense   s    ;;$**$4TZZLekk]RSTUUDJJOOU[[-=-=>

4 #%EEll///FVXXzz$++,A$++t||TYYBvE22rt   c                &    V P                  VR 4      # )_plus__binoptr[   r   s   &&rd   _add_sparse_cs_matrix._add_sparse  s    ||E8,,rt   c                &    V P                  VR 4      # )_minus_r   r   s   &&rd   _sub_sparse_cs_matrix._sub_sparse  s    ||E9--rt   c                N   \        V4      '       Ed%   V P                  VP                  8X  d$   V P                  V4      pV P                  VR4      # VP                  R
8X  d^   V P	                  VP                  4       R,          4      pV P                  ^8X  d%   VP                  ^V P                  ^ ,          34      # V# VP                  R8X  d'   V P	                  VP                  4       ^ ,          4      # V P                  R9   d*   VP	                  V P                  P                  4       4      # V P                  w  r4VP                  w  rVV^8X  d6   V^8X  d/   VP                  V P                  W44      P                  4       4      # V^8X  d6   V^8X  d/   V P                  VP                  WV4      P                  4       4      # \        V \        4      pV^8X  df   WF8X  d`   \        VP                  4       P!                  4       V4      pV P                  V4      pV P                  ^8X  d   V# VP                  ^V34      # V^8X  d@   WF8X  d:   \        V P                  4       P!                  4       V4      p	VP                  V	4      # V^8X  d@   W58X  d:   \        VP                  4       P!                  4       V4      pVP                  V 4      # V^8X  d@   W58X  d:   \        V P                  4       P!                  4       V4      p
V
P                  V4      # \#        RV P                   RVP                   24      h\$        P&                  ! V4      pVP                  ^8  d&   \$        P(                  ! V P                  4       V4      # VP*                  ^8X  dw   VP,                  \$        P.                  8X  d   \0        # \3        V P                  VP                  4      pV P	                  VP4                  ^ ,          4      P                  V4      # V P                  R9   d_   \3        V P                  VP                  4      p\$        P(                  ! V P                  P                  4       V4      P                  V4      # V P7                  4       pV P                  VP                  8X  df   \$        P(                  ! VP                  WP8                  ,          4      pVP;                  \$        P<                  4      P!                  4       Vn        V# \$        P>                  ! V4      pV P                  ^ ,          ^8X  g   V P                  ^8X  Ed   VP                  ^,          ^8X  d#   \$        P(                  ! VP                  V4      pMVP                  ^,          V P                  R,          8X  d6   \$        P(                  ! VP                  VRVP@                  3,          4      pM%\#        RV P                   RVP                   24      hV PC                  VP@                  VPD                  VP                  ^ ,          ,          R7      p\$        PF                  ! \$        PH                  ! VP                  ^ ,          VR7      VPD                  4      p\$        PJ                  ! VP@                  PM                  VRR7      VP                  ^ ,          4      pV PO                  VP;                  \$        P<                  4      P!                  4       VV33VP                  ^ ,          V P                  R,          3RR	7      # V P                  ^,          ^8X  Ed   VP                  ^ ,          ^8X  d*   \$        P(                  ! VP                  R,          V4      pMVP                  ^ ,          V P                  ^ ,          8X  d:   \$        P(                  ! VP                  R,          WPP                  ,          4      pM%\#        RV P                   RVP                   24      hV PC                  VPP                  VPD                  VP                  ^,          ,          R7      p\$        PF                  ! VPP                  PM                  VRR7      VP                  ^,          4      p\$        PJ                  ! \$        PH                  ! VP                  ^,          VR7      VPD                  4      pV PO                  VP;                  \$        P<                  4      P!                  4       VV33V P                  ^ ,          VP                  ^,          3RR	7      # VP                  ^ ,          ^8X  dm   V P                  ^,          VP                  ^,          8X  dD   \$        P(                  ! VP                  VRVP@                  3,          P!                  4       4      pMVP                  ^,          ^8X  dj   V P                  ^ ,          VP                  ^ ,          8X  dA   \$        P(                  ! VP                  WPP                  ,          P!                  4       4      pM%\#        RV P                   RVP                   24      hVP;                  \$        P<                  4      P!                  4       Vn        V# )z?Element-wise multiplication by array/matrix, vector, or scalar._elmul_inconsistent shapes r   NNNr/   r2   Fr:   r5   r8      r   )rl   rl   r   )r   r   rj   )r   N))r   r5   rT   r   _mul_scalartoarrayrX   reshaperB   sumrH   _matmul_sparsetocscrD   r   _make_diagonal_csrravelrS   rK   
asanyarraymultiplysizer3   object_NotImplementedr(   flattocoocoordsviewndarray
atleast_2dcolrI   r   repeatarangetilerY   rO   row)r[   r   r   sMsNoMoNis_array	new_otherr8   new_selfbshaperetrB   other2dr_   r   r   s   &&                rd   _multiply_2d_with_broadcasting)_cs_matrix._multiply_2d_with_broadcasting  s    E??zzU[[(u-||E955{{f$))%--/$*?@99>!>>1djjm*<=={{d"''(:;;zz^+((99 &&FB''FBQw27++DLL,@,F,F,HIIQw27**5==+@+F+F+HII!$0HQw28.u}}/D/D/FQ	,,Y7!%avLV^^QG5LLQw28)$,,.*>*>*@(K++D11 Qw28.u}}/D/D/FQ	 //55Qw28-dlln.B.B.DhO..u553DJJ<uU[[MRSS e$::>;;t||~u55::?{{bjj(%%%djj%++>F##EJJqM2::6BB::'%djj%++>F;;tyy}}6>>vFFjjl::$;;sxxzz):;Dyy,224CHJ --&::a=Aa}}Q1${{388W5q!TZZ^3{{388WQZ-@A #7

|5!VWW--cgg58WWw}}Q?O5O . QI))BIIgmmA&6iH#''RC''#''...?qAQRC&&2::&,,.c
;}}Q'B8 '   ::a=A}}Q1${{388G#4g>q!TZZ]2{{388G#4ggg6FG #7

|5!VWW--cgg58WWw}}Q?O5O . QI))CGGNN95NA7==QRCSTC''"))GMM!$4IFPC&&2::&,,.c
;zz!}gmmA&67 '   ==q TZZ]gmmA6F%F;;sxxCGG)<)B)B)DED]]1"tzz!}a8H'H;;sxx)9)?)?)ABD3DJJ<uU[[MRSS99RZZ(..0
rt   c           	        V P                   w  r#\        P                  ! V\        V P                  P
                  VP                  P
                  4      R 7      p\        \        V P                  R,           4      pV! W#V P                  V P                  V P                  W4       V P                  ^8X  d
   V^ ,          # T# )r2   _matvec)rH   rK   rL   r   r3   r   getattrr   r>   r@   rA   rB   rX   )r[   r   r]   r^   r   fns   &&    rd   _matmul_vector_cs_matrix._matmul_vector  s       !;tzz@P@P#QR \4;;#:;
1dllDIIuE IINvay66rt   c                   V P                   w  r#VP                  R,          p\        P                  ! W$3\	        V P
                  P                  VP
                  P                  4      R7      p\        \        V P                  R,           4      pV! W#W@P                  V P                  V P                  VP                  4       VP                  4       4       V P                  ^8X  d   VP                  V34      # V# )r   r2   _matvecsrj   )rH   r5   rK   rL   r   r3   r   r   r   r>   r@   rA   rB   r   rX   r   )r[   r   r]   r^   n_vecsr   r   s   &&     rd   _matmul_multivector_cs_matrix._matmul_multivector  s      R1+ +DJJOOU[[=M=M NP \4;;#;<
1dllDII;;=&,,.	* 99>>>6),,rt   c                   V P                   w  r#VP                  pV^8X  d/   VP                  ^VP                  ^ ,          34      P                  pVP                  ^8X  d   VP
                  MVP                  ^ ,          ^3w  rVRpV P                  ^8X  d
   Wr3,          pV^8X  d
   Wv3,          pV P                  ^8X  d   TM^V^8X  d   TM^3pV P                  V4      pV P                  V P                  VP                  VP                  3p	V P                  W&34      w  r&V P                  W34      w  rV P                  V	4      p\        P                  ! V
P                  VR7      p\        P                  ! V
P                  VR7      p\        P                  ! VP                  VR7      p\        P                  ! VP                  VR7      p\        W&WVV4      pV^ 8X  do   VR8X  d7   \        P                  ! ^ \        V P                   VP                   4      R7      # V P                  V\        V P                   VP                   4      R7      # V P                  V	VR7      pVV8w  d   Tp\        P                  ! V
P                  VR7      p\        P                  ! V
P                  VR7      p\        P                  ! VP                  VR7      p\        P                  ! VP                  VR7      p\        P"                  ! V^,           VR7      p\        P"                  ! VVR7      p\        P"                  ! V\        V P                   VP                   4      R7      p\%        W&WV
P&                  VVVP&                  VVV4       VR8X  d   \        P                  ! V^ ,          4      # V P                  VVV3VR7      pW8w  d3   VP(                  R8w  d   VP+                  4       pVP                  V4      pV# )r   r2   r/   r5   csr )rH   rX   r   r5   r   rC   rT   r@   rA   rG   rI   rK   rV   r   rR   r   r3   emptyr   rB   r>   tocsr)r[   r   r]   K1o_ndimK2r^   	new_shape
faux_shapeindex_arrayssor_   s_indptr	s_indiceso_indptr	o_indicesr   new_idx_dtyper@   rA   rB   r   s   &&                     rd   r   _cs_matrix._matmul_sparse  s   !!Q;MM1ekk!n"5688E %

aekk!na5H 	99>IQ;I99>aqv{!J
u%T\\5<<Ozz1&!zz4-()),7	::ahhi8JJqyy	:	::ahhi8JJqyy	:	h8YO!8Bxx

EKK)HII>>)6$**ekk3R>SS--l3-GI%%Izz!(()<H

199I>Izz!(()<H

199I>I!a%y1((3i0xx6$**ekk#BC1Y7D	*
 ?88DG$$nndGV4JnG"zzU"iik++i(C
rt   c           
        V P                  V P                  4      w  r#V P                  W) 34      w  rW) 8:  g   W8  d-   \        P                  ! ^ V P                  P
                  R7      # \        P                  ! \        V\        V^ 4      ,           V\        V^ 4      ,
          4      \        V P
                  4      R7      p\        WW0P                  V P                  V P                  V4       V# )rl   r2   )rG   r5   rK   r   rB   r3   r   rJ   r   r   r@   rA   )r[   kr]   r^   rq   r   s   &&    rd   diagonal_cs_matrix.diagonal  s    zz$**%zz1b'"7af88ATYY__55HHSSAYC1I6fTZZ>PQQ1kk4<<AFrt   c                   V P                   ^8X  d   \        V R4      '       g   WP                  R4      ^ ,          9   d   \        V P                  4      p\
        P                  ! \        V P                  4      ^,
          VR7      pV P                  \
        P                  4      w  rgWuV&   V P                  V4      pV^,          ^8X  d   VP                  pVP                  RW#R7      # \        P                  ! WW#R7      # )ztSum the array/matrix over the given axis.  If the axis is None, sum
over both rows and columns, returning a scalar.
	blocksizer2   )rp   r3   out))r   rj   )rl   r   )rX   hasattrrG   r%   r3   rK   rL   rN   r@   _minor_reduceadd_ascontainerr   r   r   )r[   rp   r3   r   	res_dtyper   major_indexvalues   &&&&    rd   r   _cs_matrix.sum  s     IIN74#=#=

#56q99%djj1I((3t{{+a/yAC!%!3!3BFF!;K$##C(Cax1}ee77%799;;teEErt   c                    Vf   V P                   p\        P                  ! \        P                  ! V P                  4      4      pVP                  V\        V P                  V,          4      4      pW43# )aS  Reduce nonzeros with a ufunc over the minor axis when non-empty

Can be applied to a function of self.data by supplying data parameter.

Warning: this does not call sum_duplicates()

Returns
-------
major_index : array of ints
    Major indices where nonzero

value : array of self.dtype
    Reduce result for nonzeros in each major_index
)rB   rK   flatnonzeroro   r@   reduceatr$   )r[   ufuncrB   r  r  s   &&&  rd   r   _cs_matrix._minor_reduce  sX     <99DnnRWWT[[%9:t24;;{3KLN!!rt   c                   V P                  V P                  4      w  r4V P                  W34      w  rV\        W4V P                  V P                  V P
                  WU^,           Wf^,           4	      w  rxp	V	P                  V P                  R7      # )r   r2   )rG   r5   r   r@   rA   rB   r   r3   )
r[   r   r   r]   r^   majorminorr@   rA   rB   s
   &&&       rd   _get_intXint_cs_matrix._get_intXint  sp    zz$**%zz3*- 1$++t||TYY19eQY!0 xxdjjx))rt   c                    V P                  W34      w  r4VP                  R9   d%   VP                  R9   d   V P                  W4RR7      # V P                  V4      P	                  V4      # )r   Tr:   r   N)rG   step_get_submatrix_major_slice_minor_slicer[   r   r   r  r  s   &&&  rd   _get_sliceXslice_cs_matrix._get_sliceXslice&  s]    zz3*-::"uzzY'>&&u$&??  '44U;;rt   c                   V P                   P                  pV P                  V P                  4      w  rEV P                  W34      w  rg\        P
                  ! WcR 7      p\        P
                  ! WsR 7      p\        P                  ! VP                  V P                  R 7      p\        WEV P                  V P                   V P                  VP                  VP                  4       VP                  4       V4	       VP                  ^8X  d   V P                  V4      # V P                  VP                  VP                  4      4      # )r2   )rA   r3   rG   r5   rK   rV   r   r   r   r@   rB   r   rX   r  rT   r   )	r[   r   r   r_   r]   r^   r  r  vals	   &&&      rd   _get_arrayXarray_cs_matrix._get_arrayXarray,  s    LL&&	zz$**%zz3*-

52

52hhuzz4!T\\499**ekkmU[[]C	I::?$$S))~~ckk%++677rt   c                j    V P                  W34      w  r4V P                  V4      P                  V4      # N)rG   _major_index_fancy_minor_index_fancyr  s   &&&  rd   _get_columnXarray_cs_matrix._get_columnXarray;  s0    zz3*-&&u-@@GGrt   c           	        V P                  V P                  V P                  34      p\        P                  ! WR7      P                  4       pV P                  V P                  4      ^,          p\        V4      pV P                  ^8X  d   V P                  WT34      MV3pV^ 8X  d   V P                  W`P                  R7      # V P                  P                  VRR7      pV P                  P                  VRR7      pWs^,           ,          Ws,          ,
          p	\        P                  ! V^,           VR7      p
\        P                  ! WR,          R7       V
R,          p\        P                  ! WR7      p\        P                  ! WP                  R7      p\!        VVVVV P"                  VV4       V P                  WV
3VRR7      # )zBIndex along the major axis where idx is an array of ints.
        r2   Fr:   r   NNr   r   rj   )rI   r@   rA   rK   rV   r   rG   rH   rN   rX   rT   r3   rY   rL   cumsumr   r   rB   )r[   r{   r_   rA   r^   r]   r   self_indptrself_indicesrow_nnz
res_indptrr   res_indicesres_datas   &&            rd   r  _cs_matrix._major_index_fancy@  sl    ))4;;*EF	**S288:JJt(()!,L*.))q.DJJv&qd	6>>)::>>>kk(((?||**95*Ak*[-AAXXa!e95

		'"~.nhhs488Czz2II	
 ~~xjA$-E  ; 	;rt   c           
        V\        R4      8X  d   V'       d   V P                  4       # T # V P                  V P                  4      w  r4VP	                  V4      w  rVp\        \        WVV4      4      pV P                  ^8X  d   V P                  W434      MV3pV^ 8X  d   V P                  WP                  R7      # YVrVR8X  d
   V^ 8  d   Rp
V^,           V^,           rV P                  WV1,          V P                  WV1,          ,
          pV P                  P                  p\        P                  ! V^,           VR7      p\        P                  ! WR,          R7       V^8X  d   \        V P                  V,          V P                  V,          4      p\        P                  ! V P                  V,          VR7      p\        P                  ! V P                  V,          VR7      pMqVR,          p\        P                   ! VVR7      p\        P                   ! VV P                  R7      p\#        WVWpP                  V P                  V P                  VV4       V P                  VVV3VRR7      # )	z@Index along the major axis where idx is a slice object.
        Nr2   r$  r%  r:   Fr   rj   )slicer8   rG   rH   rA   rN   rangerX   rT   r3   r@   rK   rL   r&  rR   rB   r   r   )r[   r{   r8   r]   r^   startstopr  r   start0stop0start1stop1r)  r_   r*  all_idxr+  r,  r   s   &&&                 rd   r  _cs_matrix._major_slicec  s    %+"&499;0D0zz$++,KKNTe4()*.))q.DJJv&qd	6>>)::>>> 2:%1*E	4!8++f4/0KKT)*+LL&&	XXac3

		'"~.19DKK.D0ABG((4<<#8tDKxx		' 2>HR.C((3i8Kxx4::6H%t[[$,,))[(< ~~xjA$-E  ; 	;rt   c           
        V P                  V P                  V P                  34      pV P                  P                  VRR7      pV P                  P                  VRR7      p\        P
                  ! WR7      P                  4       pV P                  V P                  4      w  rV\        V4      pV P                  ^8X  d   V P                  WW34      MV3pV^ 8X  d   V P                  WP                  R7      # \        P                  ! WbR7      p	\        P                  ! V P                  VR7      p
\        VVVVVVV	V
4       \        P                   ! V4      P                  VRR7      pV
R,          p\        P"                  ! WR7      p\        P"                  ! WP                  R7      p\%        W\        V P                  4      W0P&                  W4       V P                  WV
3VRR7      # )zBIndex along the minor axis where idx is an array of ints.
        Fr:   r2   r   rj   )rI   rA   r@   rY   rK   rV   r   rG   rH   rN   rX   rT   r3   rL   
empty_liker   argsortr   r   rB   )r[   r{   r_   rA   r@   r]   r^   r   r   col_offsetsr*  	col_orderr   r+  r,  s   &&             rd   r   _cs_matrix._minor_index_fancy  s    ))4<<*EF	,,%%ie%<##IE#:jj.446zz$++,H*.))q.DJJv&qd	6>>)::>>> hhq2]]4;;i@
		
 JJsO**95*A	nhhs488Czz2)#dll2C!99k	E~~xjA$-E  ; 	;rt   c                   V\        R4      8X  d   V'       d   V P                  4       # T # V P                  V P                  4      w  r4VP	                  V4      w  rVp\        \        WVV4      4      pV^ 8X  d.   V P                  V P                  W434      V P                  R7      # V^8X  d   V P                  WR7      # V P                  \        P                  ! WVV4      4      # )z@Index along the minor axis where idx is a slice object.
        Nr2   )r  r8   )r/  r8   rG   rH   rA   rN   r0  rT   r3   r  r   rK   r   )r[   r{   r8   r]   r^   r1  r2  r  s   &&&     rd   r  _cs_matrix._minor_slice  s     %+"&499;0D0zz$++,KKNTe4()6>>$**aV"4DJJ>GG19&&S&<<&&ryyd'CDDrt   c                   V P                  V P                  4      w  rE\        W4      w  rg\        W%4      w  rV^ 8X  d.   V^ 8X  d'   Wt8X  d!   W8X  d   V'       d   V P                  4       # T # \	        WEV P
                  V P                  V P                  WgW4	      w  rpV P                  Wv,
          W,
          34      pV P                  ^8X  d   V^,          3pV P                  WV
3VV P                  RR7      # )zRReturn a submatrix of this matrix.

major, minor: None, int, or slice with step 1
F)r5   r3   r8   )rG   rH   _process_slicer8   r   r@   rA   rB   rX   rT   r3   )r[   r  r  r8   r]   r^   i0i1j0j1r@   rA   rB   r5   s   &&&&          rd   r  _cs_matrix._get_submatrix  s    
 zz$++,))7rQw27rw"&499;0D0 1$++t||TYY!H 

BGRW-.99>1XKE~~tf5U$(JJU  < 	<rt   c                R    V P                  W34      w  rEV P                  WEV4       R # r  rG   	_set_manyr[   r   r   r   r}   r~   s   &&&&  rd   _set_intXint_cs_matrix._set_intXint  "    zz3*%qQrt   c                R    V P                  W34      w  rEV P                  WEV4       R # r  rI  rK  s   &&&&  rd   _set_arrayXarray_cs_matrix._set_arrayXarray  rN  rt   c                   V P                   ! V P                  W34      !   VP                  w  rEV^8g  ;'       d    VP                  ^ ,          ^8H  pV^8g  ;'       d    VP                  ^,          ^8H  pVP                  VP                  r\
        P                  ! VP                  V P                  R7      pVP                  ^ 8X  d   R# V'       da   \
        P                  ! \
        P                  ! V4      \        V4      4      p\
        P                  ! W4      p	\
        P                  ! W44      pV'       da   \
        P                  ! W4      p\
        P                  ! \
        P                  ! V4      \        V	4      4      p	\
        P                  ! W54      pV P                  WV	3,          W(V	3,          34      w  rV P                  WV4       R# )r   r2   N)
_zero_manyrG   r5   r   r   rK   rV   rB   r3   r   r   r   rN   r   rJ  )r[   r   r   r   r]   r^   broadcast_rowbroadcast_colrcr}   r~   s   &&&&        rd   _set_arrayXarray_sparse"_cs_matrix._set_arrayXarray_sparse  s4   SJ/0yyQ221771:?Q221771:?uuaee1JJqvvTZZ066Q;		"))A,A/AAA		!A		!c!f-A		!Azz3!t9cQ$i01qQrt   c           
     j   ^ V P                   9   d   R# V P                  ^8X  d   \        R4      hV P                   w  r4VP                  ^ 8H  pV^ 8  d   V'       d   \        W2,           V4      pM\        W2,           V\	        V4      4      p\
        P                  ! V) Wb,
          V P                  P                  R7      p\
        P                  ! W`P                  P                  R7      pMV'       d   \        W4V,
          4      pM\        W4V,
          \	        V4      4      p\
        P                  ! W`P                  P                  R7      p\
        P                  ! W"V,           V P                  P                  R7      pV'       g   VR\	        V4       p\
        P                  ! \
        P                  ! WP                  R7      4      P                  4       p	V	P                  4       P                   VP                  4       P                   8w  d!   \
        P                  ! WP                   4      p	V	P                  ^ 8X  d   R# V P                  W434      w  r4V P                  Wx34      w  rxV	P                  p
\
        P                   ! WP                  P                  R7      p\#        W4V P$                  V P                  V
WxV4      pV^8X  d5   V P'                  4        \#        W4V P$                  V P                  V
WxV4       RV9  d   WP(                  V&   R# V^ 8  p\	        V4      \
        P*                  ! V4      ,
          pWP,                  R,          8  d[   W,          V P(                  W,          &   \
        P.                  ! WR7      p?V P1                  W,          W,          W,          4       R# V P2                  pV P5                  4       pVP7                  W4       VP9                  V P                  4      pVw  V n        V n        V n        pV'       d   RV n        V P;                  4        R# R# )rl   Nz"diagonals cant be set in 1d arraysr2   gMbP?r%  Frj   )r5   rX   NotImplementedErrorr   rN   rK   r   rA   r3   
atleast_1drV   r   squeezebroadcast_tor   rG   r   r   r@   rQ   rB   rv   r   logical_not_insert_manyhas_sorted_indicesr   _setdiagrP   sort_indices)r[   valuesr   r]   r^   	broadcast	max_indexr}   r~   r   	n_samplesoffsetsr   is_existingN_newis_newdo_sortr`   ra   rq   s   &&&                 rd   rb  _cs_matrix._setdiag  s   

?99>%&JKKzz[[A%	q5qM	q#f+6			1"im4<<3E3EFA		)<<+=+=>A q5M	q5#f+6			)<<+=+=>A		!]$,,2D2DEAGSV_FMM"**V::>?EEG99;		 1 1177+A66Q;zz1&!zz1&!FF	((9LL,>,>? t{{DLL)!"w0!8!qT[[$,,	 W.W!"IIg!|K 2#3#3K#@@ 88e##./nDIIg*+^^KAFaiAI> --G**,CLL#++DJJ7F6<3DKty!*/'!!# rt   c                   V P                  V P                  4      w  r4R  p\        P                  ! \        P                  ! WP
                  P                  R7      4      P                  4       p\        P                  ! \        P                  ! W P
                  P                  R7      4      P                  4       pV! W4       V! W$4       WW43# )c                     V P                  4       pW!8  d   \        R V RV R24      hV P                  4       pW!) 8  d   \        R V RV R24      hR# )zindex (z) out of range (>= r   z) out of range (< -N)rJ   
IndexErrorr   )rA   boundr{   s   && rd   check_bounds1_cs_matrix._prepare_indices.<locals>.check_boundsE  s_    ++-C| 73%/B5'!KLL++-CV| 73%/B5'!KLL rt   r2   )rG   rH   rK   r\  rV   rA   r3   r   )r[   r}   r~   r]   r^   rr  s   &&&   rd   _prepare_indices_cs_matrix._prepare_indicesB  s    zz$++,	M MM"**Qll.@.@ABHHJMM"**Qll.@.@ABHHJQQQzrt   c           
     T   V P                  W4      w  rrE\        P                  ! \        P                  ! W0P                  R7      4      P                  4       pVP                  p\        P                  ! W`P                  P                  R7      p\        WEV P                  V P                  VWV4      pV^8X  d5   V P                  4        \        WEV P                  V P                  VWV4       RV9  d   W0P                  V&   R# \        RV P                  P                   R2\         ^R7       VR8  p	W9,          V P                  Wy,          &   V	( p	W,          pW^ 8  ;;,          V,          uu&   W),          pW"^ 8  ;;,          V,          uu&   V P#                  WW9,          4       R# )zwSets value at each (i, j) to x

Here (i,j) index major and minor respectively, and must not contain
duplicate entries.
r2   Nz%Changing the sparsity structure of a z. is expensive. lil and dok are more efficient.r   rj   )rt  rK   r\  rV   r3   r   r   r   rA   r   r@   rQ   rB   r   rT   rU   r   r`  )
r[   r}   r~   r   r]   r^   rg  rh  r   rz   s
   &&&&      rd   rJ  _cs_matrix._set_manyS  sS    **10
aMM"**Qjj9:@@BFF	((9LL,>,>? t{{DLL)!"w0!8!qT[[$,,	 W. W!"IIg 89P9P8Q R? ?(Q8 R<D'(wDIIgm$5DA!eHMHA!eHMHaAG,rt   c           
        V P                  W4      w  rr4\        V4      p\        P                  ! WPP                  P
                  R7      p\        W4V P                  V P                  VWV4      pV^8X  d5   V P                  4        \        W4V P                  V P                  VWV4       ^ V P                  WfR8  ,          &   R# )zrSets value at each (i, j) to zero, preserving sparsity structure.

Here (i,j) index major and minor respectively.
r2   Nrj   )
rt  rN   rK   r   rA   r3   r   r@   rQ   rB   )r[   r}   r~   r]   r^   rg  rh  r   s   &&&     rd   rS  _cs_matrix._zero_manyz  s    
 **10
aF	((9LL,>,>? t{{DLL)!"w0!8!qT[[$,,	 W. ,-		'B,'(rt   c                   \         P                  ! VRR7      pVP                  VRR7      pVP                  VRR7      pVP                  VRR7      pV P                  pV P	                  V P
                  V P                  3V P                  R,          VP                  ,           R7      p\         P                  ! V P                  VR7      V n        \         P                  ! V P
                  VR7      V n        \         P                  ! WR7      p\         P                  ! W&R7      p. p. p\         P                  ! VRR7      w  r\         P                  ! V
\        V4      4      p
\         P                  ! V
4      p^ p\        \        WV
R	,          4      4       EF(  w  pw  rpV P                  V,          pV P                  V,          pVP                  V P
                  VV 4       VP                  V P                  VV 4       \         P                  ! W/V R
R
R1,          RR7      w  pp\        V4      VV,
          8X  d(   VP                  W/V 4       VP                  W?V 4       MUVP                  W/V R
R
R1,          V,          4       VP                  W?V R
R
R1,          V,          4       \        V4      W&   TpEK+  	  V P                  X,          pVP                  V P
                  VR
 4       VP                  V P                  VR
 4       \         P                   ! V4      V n        \         P                   ! V4      V n        \         P"                  ! V P                  P$                  VR7      pV! ^ 4      V^ &   \         P                  ! V P                  4      pVV	;;,          V,          uu&   VVR	&   \         P&                  ! VVR7      V n        V'       d   RV n        V P)                  4        V P+                  RR7       R
# )a
  Inserts new nonzero at each (i, j) with value x

Here (i,j) index major and minor respectively.
i, j and x must be non-empty, 1d arrays.
Inserts each major group (e.g. all entries per row) at a time.
Maintains has_sorted_indices property.
Modifies i, j, x in place.
	mergesort)r   clip)moder/   r2   T)return_indexr$  Nr%  Fr;   rj   )rK   r;  takera  rI   rA   r@   r   rV   uniqueappendrN   ro   	enumerateziprB   concatenater   r5   r&  rc  rZ   )r[   r}   r~   r   r   rl  r_   indices_parts
data_partsui	ui_indptrnew_nnzsprevrW  iijsjer1  r2  uj	uj_indptrnnzsindptr_diffs   &&&&                   rd   r`  _cs_matrix._insert_many  s    

1;/FF5vF&FF5vF&FF5vF&)) ))4<<*E,0KKOaff,D * G	jjI>zz$,,i@JJq*JJq* 
		!$7IIiQ0	779%(RIbM)JKOA|KK%E;;r?D  eD!9:diid34 IIa2httn4HMB	2w"r'!$$Q"X.!!!r(+$$Q"Xdd^I%>?!!!r(4R4.";<!"gD#  L( BT\\%&12$))EF+, ~~m4NN:.	xx));A,Qggdkk*B8#Rii$/&+D#U+rt   c                "   V P                   ^8X  dF   V P                  4       pV P                  VP                  VP                  33VP
                  VR7      # V P                  V P
                  4      w  r4V P                  p\        P                  ! \        V4      V P                  P                  R7      p\        W0P                  V4       V P                  We34      pV P                  V P                  V3V P
                  WP                  R7      # )r   r:   r2   r7   )rX   r   rO   rB   rA   r5   rG   rK   r   rN   r3   r   r@   )r[   r8   r   	major_dim	minor_dimminor_indicesmajor_indicesr   s   &&      rd   r   _cs_matrix.tocoo  s    99>**,C&&3;;.'A399SW&XX#zz$**5	]!34<<;M;MN)[[-8]:;""YY$jj # 
 	
rt   c                   Vf   Vf   V P                  R4      ^ ,          pV P                  W4      pVP                  P                  '       g(   VP                  P                  '       g   \        R4      hVP                  P                  '       d   V P                  4       pTpMV P                  4       pVP                  pVP                  VP                  4      w  rV\        WVVP                  VP                  VP                  V4       V# )Ncfz&Output array must be C or F contiguous)rG   _process_toarray_argsr   r   f_contiguousrS   r   r   r   rH   r   r@   rA   rB   )r[   r   r   r   r   r]   r^   s   &&&    rd   r   _cs_matrix.toarray  s    ;5=JJt$Q'E((4		&&&#))*@*@*@EFF99!!!

AA

AAwwq~~&A!((AIIqvvq9
rt   c                    V P                  V P                  4      w  r\        WV P                  V P                  V P
                  4       V P                  4        R# )zLRemove zero entries from the array/matrix

This is an *in place* operation.
N)rG   rH   r   r@   rA   rB   r   r[   r]   r^   s   &  rd   r   _cs_matrix.eliminate_zeros  s=    
 zz$++,A$++t||TYYG

rt   c                    < V ^8  d   QhRS[ /#    returnbool)r>   __classdict__s   "rd   __annotate___cs_matrix.__annotate__  s     * *d *rt   c                   \        V RR4      '       g   RV n        V P                  # \        V R4      '       gK   \        V P                  4      ^,
          p\        \        WP                  V P                  4      4      V n        V P                  # )a"  Whether the array/matrix has sorted indices and no duplicates

Returns
    - True: if the above applies
    - False: otherwise

has_canonical_format implies has_sorted_indices, so if the latter flag
is False, so will the former be; if the former is found True, the
latter flag is also set.
_has_sorted_indicesTF_has_canonical_format)	r   r  r   rN   r@   r  r   rA   has_canonical_formatr[   r]   s   & rd   r  _cs_matrix.has_canonical_format
  sz     t2D99).D& ))) 677DKK 1$A(,(KKF)D% )))rt   c                    < V ^8  d   QhRS[ /# r  r  r  )r>   r  s   "rd   r  r  "  s     + + +rt   c                H    \        V4      V n        V'       d
   R V n        R# R# )TN)r  r  ra  r[   r  s   &&rd   r  r  !  s    %)#Y"&*D# rt   c                   V P                   '       d   R# V P                  4        V P                  V P                  4      w  r\	        WV P
                  V P                  V P                  4       V P                  4        RV n         R# )zVEliminate duplicate entries by adding them together

This is an *in place* operation.
NT)	r  rc  rG   rH   r   r@   rA   rB   r   r  s   &  rd   rQ   _cs_matrix.sum_duplicates'  s`    
 $$$zz$++,1dllDIIF

$(!rt   c                    < V ^8  d   QhRS[ /# r  r  )r>   r  s   "rd   r  r  7  s     ( (D (rt   c                    \        V R4      '       gK   \        V P                  4      ^,
          p\        \	        WP                  V P
                  4      4      V n        V P                  # )zWhether the indices are sorted

Returns
    - True: if the indices of the array/matrix are in sorted order
    - False: otherwise
r  )r   rN   r@   r  r   rA   r  r  s   & rd   ra  _cs_matrix.has_sorted_indices6  sR     t233DKK 1$A'+&q++t||D(D$ '''rt   c                    < V ^8  d   QhRS[ /# r  r  )r>   r  s   "rd   r  r  G  s     - -d -rt   c                &    \        V4      V n        R # r  )r  r  r  s   &&rd   ra  r  F  s    #'9 rt   c                F    V P                  4       pVP                  4        V# )z?Return a copy of this array/matrix with sorted indices
        )r8   rc  )r[   As   & rd   sorted_indices_cs_matrix.sorted_indicesK  s     IIK	rt   c                    V P                   '       gQ   \        V P                  4      ^,
          p\        WP                  V P                  V P
                  4       RV n         R# R# )z9Sort the indices of this array/matrix *in place*
        TN)ra  rN   r@   r   rA   rB   r  s   & rd   rc  _cs_matrix.sort_indicesV  sH     &&&DKK 1$AQT\\499E&*D# 'rt   c                   V P                  V P                  4      ^ ,          p\        V P                  4      V^,           8w  d   \	        R4      h\        V P
                  4      V P                  8  d   \	        R4      h\        V P                  4      V P                  8  d   \	        R4      h\        V P
                  RV P                   4      V n        \        V P                  RV P                   4      V n        R# )z8Remove empty space after all non-zero elements.
        z index pointer has invalid lengthz)indices array has fewer than nnz elementsz&data array has fewer than nnz elementsN)	rG   rH   rN   r@   rS   rA   r   rB   r   )r[   r  s   & rd   r   _cs_matrix.prune^  s     JJt001!4	t{{y1},?@@t||txx'HIItyy>DHH$EFF#DLL$(($;< 9DHH!56	rt   c                   \        WP                  R 7      p\        V R4      '       d   V P                  w  r#\	        V^ ,          V4      w  rE\	        V^,          V4      w  rgV'       g	   V'       d   \        RV P                   RV 24      hV P                  ^ ,          V,          V P                  ^,          V,          rMKT P                  \        V4      ^8  d   TM
^V^ ,          34      w  rFV P                  V P                  4      w  rWH8  dg   V P                  RV P                  V,           V n
        V P                  RV P                  V,           V n        V P                  RV^,            V n        MiWH8  dd   \        P                  ! V P                  V^,           4      V n        V P                  V^,           R P                  V P                  V,          4       Wi8  d   V P                  V8  p
\        P                   ! V
4      '       g   V P                  V
,          V n
        V P                  V
,          V n        V P#                  \        P$                  V
4      w  rV P                  P                  ^ 4       WP                  R,          V&   \        P&                  ! V P                  V P                  R7       Wn        R# )r-   r   zshape must be divisible into z blocks. Got Nr$  r%  )r&   rF   r   r   divmodrS   r5   rG   rN   rH   rA   r@   rB   rK   resizefillrw   r   r   r&  rC   )r[   r5   bmbnnew_Mrmnew_Nrnr]   r^   rz   r  r  s   &*           rd   r  _cs_matrix.resizem  s   ENN;4%%^^FBuQx,IEuQx,IER #@@P#0"9 : :::a=B&

1(;q::s5z!|e!U1XOLE::d//0DA9<<(;U);<DL		"54;;u#56DI++juqy1DKY))DKK;DKKKA$$T[[^49<<%'D66$<<#||D1 IIdO	#'#5#5bffd#C   #/2B,		$++4;;7rt   c                B   V'       d[   V P                  WP                  P                  4       V P                  P                  4       3V P                  VP
                  R7      # V P                  WP                  V P                  3V P                  VP
                  R7      # )zReturns a matrix with the same sparsity structure as self,
but with different data.  By default the structure arrays
(i.e. .indptr and .indices) are copied.
r4   )rT   rA   r8   r@   r5   r3   )r[   rB   r8   s   &&&rd   r   _cs_matrix._with_data  s    
 >>4):):)<#';;#3#3#5#7(,

(,

 " 4 4
 >>4t{{"C(,

$** " F Frt   c                P   V P                  V4      p\        \        RV,           R,           4      pV P                  VP                  ,           pV P	                  V P
                  V P                  VP
                  VP                  3VR7      p\        P                  ! V P
                  P                  VR7      p\        P                  ! WER7      p. ROpW(9   d(   \        P                  ! V\        P                  R7      p	M6\        P                  ! V\        V P                  VP                  4      R7      p	V P                  V P                  4      w  rV! W\        P                  ! V P
                  VR7      \        P                  ! V P                  VR7      V P                   \        P                  ! VP
                  VR7      \        P                  ! VP                  VR7      VP                   WgV	4       V P                  WV3V P                  R7      pVP#                  4        V# )z5apply the binary operation fn to two sparse matrices.r   r/   r2   r   )_ne__lt__gt__le__ge_)rT   r   r   r   rI   r@   rA   rK   r   r5   bool_r   r3   rG   rH   rV   rB   r   )r[   r   r   r   maxnnzr_   r@   rA   bool_opsrB   r]   r^   r  s   &&&          rd   r   _cs_matrix._binopt  s}   u% \52:#56EII%))4;;%*\\5==+B+1 * 3	 $++++9=((63;>88F"((3D88F&U[[*IJDzz$++,
1::dkk3::dll)499::ell)4::emm95::D	" NND62$**NE		rt   c                ~   VP                   V P                   8w  d&   \        RV P                    RVP                    24      hV P                  VR4      p\        P                  ! VP
                  \        P                  4      '       d   \        P                  ! V P                   V P
                  R7      pVP                  \        P                  4       VP                  4       pV P                  ^8X  d   VR,          3p^ W4&   VP                  4       pVP                  W2P                  &   V P                  V4      # TpV# )z/
Divide this matrix by a second sparse matrix.
r   r   _eldiv_r2   rj   )r5   rS   r   rK   
issubdtyper3   inexactr   r  nannonzerorX   r   rB   r   r   )r[   r   rV  r   r   s   &&   rd   _divide_sparse_cs_matrix._divide_sparse  s     ;;$**$3DJJ<uU[[MRSSLL	*=="**--
 ((4::TZZ8CHHRVV]]_FyyA~ *CK	AFFCM??3'' CJrt   c                z   V P                   V8X  d   V'       d   V P                  4       # T # \        WP                  R 7      p\	        V P                   V4      V8w  d   \        R4      h\        V P                   4      ^8X  d   \        V4      ^8X  d   V P                  4        V P                  ^ 8X  d   V P                  WP                  RR7      # V^ ,          p\        P                  ! W0P                  ^ ,          4      p\        P                  ! ^ V4      p\        P                  ! ^ V.4      pV P!                  WEV3VRR7      # V P"                  p\        V4      ^8w  d   \        V4      p\        RV R24      hV P                  ^ 8X  d   V P                  WP                  RR7      # V P                  4        V P%                  V4      w  rV P%                  V4      w  r\&        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   \        P                  ! W,          V P                  ^ ,          4      p\        P(                  ! \        P                  ! V4      V	4      p\        P                  ! ^ \        V4      ^,           V4      pEM
V
^8X  d   W8X  d   \        P(                  ! V P                  V	4      p\        P(                  ! V P*                  V	4      p\        P                  ! ^ \        V4      ^,           \        V P                  4      4      pMV^8X  dy   W8X  ds   \        P,                  ! V P                  V4      p\        P(                  ! \        P                  ! V4      \        V P                  4      4      pV P.                  V,          pV P                  XXX3VRR7      # )	r-   zcannot be broadcastF)r3   r8   r   z0CSR/CSC broadcast_to cannot have shape >2D. Got Dc              3   *   "   T F	  q^8H  x  K  	  R# 5ir  r   ).0r   s   & rd   	<genexpr>+_cs_matrix._broadcast_to.<locals>.<genexpr>  s     )y!Avys   T)r5   r8   r&   rF   r(   rS   rN   rQ   r   rT   r3   rK   fullrB   r   rR   _csr_containerrH   rG   rw   r   rA   r   r@   )r[   r5   r8   r^   rB   rA   r@   	old_shaperX   r]   r   r   s   &&&         rd   _broadcast_to_cs_matrix._broadcast_to  s   ::"&499;0D0E^^=DJJ.%7233tzz?aCJ!O!xx1}~~e::E~JJaA771iil+Dii!nGXXq!f%F&&v'>eRW&XX %%	u:?u:DOPTvUVWXX88q=>>%zz>FFzz% I&3)y)333)y)))7715$))A,/DggbiilA.GYYq#d)a-3F1W77499a(DggdllA.GYYq#d)a-TYY@F1W99TYY*DggbiilC		N;G[[1_F~~tWf5U~OOrt   )r  r  rC   rB   r  ra  rA   r@   )NNFr  )T)rl   )NNNF)NN)8rU   
__module____qualname____firstlineno____doc__r=   rr   r   rv   rZ   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r!  r  r  r   r  r  rL  rP  rX  rb  rt  rJ  rS  r`  r   r   r   propertyr  setterrQ   ra  r  rc  r   r  r   r   r  r  __static_attributes____classdictcell__)r  s   @rd   r*   r*      s    V,T V,p3$ oo--GO34 $1199M7-F	3-.vx
7 ;z ''//HF, ++%%CK"4*<8H
!;F&;P%;NE <*   2H$T"%-N-(F,X
 MM))EM" oo--GO * *,   + !+
) ( ( - -+7!F ^^++FNF!F80P 0Prt   r*   c                    ^RI HpHp V'       d   TMTp\        V 4      p\	        VR7      p\
        P                  ! V^,           VR7      pVRR pV! WV3WD3R7      # )zbuild diagonal csc_array/csr_array => self._csr_container

Parameter `data` should be a raveled numpy array holding the
values on the diagonal of the resulting sparse matrix.
)	csr_array
csr_matrixr/   r2   Nr   rj   )_csrr  r  rN   r'   rK   r   )rB   r   r  r  r^   r_   r@   rA   s   &&      rd   r   r     sV     ,%	:ID	Aq)IYYq1uI.FSbkGdV,QF;;rt   c                 \   V f   ^ Tr2W#3# \        V \        4      '       d5   V P                  V4      w  r#pV^8w  d   \        R4      h\	        W#4      pW#3# \        V 4      '       d>   V ^ 8  d	   W,          p Y ^,           r2V^ 8  g   W18  d   \        RV RV RV 24      h W#3# \        R4      h)Nz$slicing with step != 1 not supportedzindex out of bounds: 0 <= z < z <= zexpected slice or scalar)rD   r/  rA   rS   r   r#   rp  	TypeError)slnumrC  rD  strides   &&   rd   rB  rB  (  s    	zCB 6M 
B		CQ;CDD[ 6M 
26IB!VB6RX9"SDNOO 
 6M 233rt   r  )6r  __all__warningsr   rx   numpyrK   scipy._lib._utilr   r   _baser   r   r   r   _datar	   r
    r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   _indexr   _sputilsr   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r*   r   rB  r   rt   rd   <module>r     sz    D
    9 F F . : : : : : V V V V
{P}j {P|'<"rt   