+
    LV-jµy  ã                   ó  € R t Rt. ROt^ RIHt ^ RIt^ RIHt ^RI	H
t
 ^RIHtHt ^R	IHt ^R
IHtHtHtHt ^RI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$  ! R R]]4      t%R t& ! R R]%]4      t' ! R R]
]%4      t(R# )z"Compressed Block Sparse Row formatzrestructuredtext enÚ	bsr_arrayÚ
bsr_matrix)ÚwarnN)Úcopy_if_needed)Úspmatrix)Ú_data_matrixÚ_minmax_mixin)Ú
_cs_matrix)ÚissparseÚ_formatsÚ_spbaseÚsparray)ÚisshapeÚgetdtypeÚgetdataÚ	to_nativeÚupcastÚcheck_shape)Ú_sparsetools)Ú
bsr_matvecÚbsr_matvecsÚcsr_matmat_maxnnzÚ
bsr_matmatÚbsr_transposeÚbsr_sort_indicesÚ	bsr_tocsrc                   ó�  a € ] tR t^t o RtR RR/R lltR!R lt]V 3R lR l4       tR"R lt	]
P                  P                  ]	n        R"R	 lt]
P                  P                  ]n        R
 tR#R lt]
P                  P                  ]n        R tR tR tR tR tR tR$R ltR%R lt]
P,                  P                  ]n        R%R lt]
P.                  P                  ]n        R!R ltR&R lt]
P2                  P                  ]n        R$R lt]
P4                  P                  ]n        R tR tR tR tR&R ltR!R lt R%R lt!Rt"V t#R# )'Ú	_bsr_baseÚbsrNÚ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R7      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    \        V4      '       Ed   \        V4      V n	        V P                  w  rxVf   RpM*\        V4      '       g   \        RV 24      h\        V4      p\         P"                  ! RV,           \%        V\&        R7      4      V n        Vw  ršWy,          ^ 8w  g   WŠ,          ^ 8w  d   \        R4      hV P)                  \+        Wy,          WŠ,          Wš4      R7      p\         P"                  ! ^ VR7      V n        \         P"                  ! Wy,          ^,           VR7      V n        EM±\-        V4      ^8X  do   V P/                  WVR7      pVP                  VR7      pVP                  VP                  VP                  VP                  3w  V n        V n        V n        V n	        EM3\-        V4      ^8X  EdX   Vw  rïp^pVe   \+        V4      pVe   \+        V\+        V4      4      pV P)                  VV3VR	R
7      pV'       g   \0        p\         P2                  ! WôVR7      V n        \         P2                  ! VWKR7      V n        \5        WäVR7      V n        V P                  P6                  ^8w  d#   \        RV P                  P                   24      hVew   \        V4      '       g   \        RV 24      h\        V4      V P                  P                  R,          8w  d-   \        RV RV P                  P                  R,           24      hMË\        R4      h \         P8                  ! V4      p\        T \<        4      '       d+   TP6                  ^8w  d   \        RTP6                   R24      hT P/                  YR7      P                  TR7      pTP                  TP                  TP                  TP                  3w  T n        T n        T n        T n	        Ve   \        V4      V n	        MxV P                  fk    \-        V P                  4      ^,
          pV P                  P+                  4       ^,           pV P>                  w  rš\        Wy,          WŠ,          34      V n	        V P                  f    Vf   \        R4      h\        V4      V n	        Ve6   V P                  PA                  \%        W0P                  4      RR7      V n        V PC                  RR7       R#   \:         d    p\        RT P                   R24      ThRp?ii ; i  \:         d   p\        R4      ThRp?ii ; i))r   ©Ú	blocksizeNzinvalid blocksize=)Údefaultz#shape must be multiple of blocksize©Úmaxval©Údtype)r'   ÚshapeT)r%   Úcheck_contents)Úcopyr'   z*BSR data must be 3-dimensional, got shape=ºé   NNzmismatching blocksize=z vs z(unrecognized bsr_array constructor usagezunrecognized form for z_matrix constructorzBSR arrays don't support zD input. Use 2Dz!unable to infer matrix dimensionszneed to infer shapeF©r*   )Ú
full_check)r,   r,   ©é    )"r   Ú__init__r
   Úformatr*   ÚtobsrÚindptrÚindicesÚdataÚ_shapeÚ
isinstanceÚtupler   r   r(   Ú
ValueErrorÚnpÚzerosr   ÚfloatÚ_get_index_dtypeÚmaxÚlenÚ_coo_containerr   Úarrayr   ÚndimÚasarrayÚ	Exceptionr   r"   ÚastypeÚcheck_format)ÚselfÚarg1r(   r'   r*   r"   r   ÚMÚNÚRÚCÚ	idx_dtypeÚcoor   r6   r5   r4   r%   Úes   &&&&&&$            Úb/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/scipy/sparse/_bsr.pyr1   Ú_bsr_base.__init__   sÞ  € ä×Ò˜d°8Õ<ä�D�>Š>Ø�{‰{˜dŸk™kÔ)¯dØ—y‘y“{‘à—z‘z¨I�zÓ6�à—‘˜TŸ\™\¨4¯9©9°d·k±kðAÑ=ˆDŒK˜œ t¤y°$¶+ô ˜œU×#Ó#Ü�t�}‹}ä)¨$Ó/�”Ø—j‘j‘�àÒ$Ø %‘Iä" 9×-Ò-Ü(Ð+=¸i¸[Ð)IÓJÐJÜ % iÓ 0�IÜŸHšH T¨IÕ%5´xÀÌuÔ7UÓV�”	à‘�Ø•E˜a”< A¥E¨a¤<Ü$Ð%JÓKÐKð !×1Ñ1¼¸Q½TÀ1Å4ÈÓ9NÐ1ÓO�	Ü!Ÿxšx¨°Ô;�”Ü Ÿhšh q¥t¨a¥x°yÔA�–ä�T“˜a”à×)Ñ)¨$À5Ð)ÓI�Ø—i‘i¨)�iÓ4�à—J‘J §¡¨S¯X©X°s·z±zðEÑA�”˜Tœ\¨4¬9°d¶kô �T“˜a•à*.Ñ'� ð �ØÒ$Ü  ›Z�FØÒ(Ü  ¬¨Y«Ó8�FØ ×1Ñ1°7¸FÐ2CÈFØAEð 2ó G�	çÜ)�DÜ!Ÿxšx¨À)ÔL�”Ü Ÿhšh v°DÔJ�”Ü# D¸5ÔA�”	Ø—9‘9—>‘> QÔ&Ü$ØDÀTÇYÁYÇ_Á_ÐDUÐVóð ð Ò(Ü" 9×-Ò-Ü(Ð+=¸i¸[Ð)IÓJÐJÜ˜YÓ'¨4¯9©9¯?©?¸2Õ+>Ô>Ü(Ø4°Y°KØ" 4§9¡9§?¡?°2Õ#6Ð"7ð9óð øô
 !Ð!KÓLÐLðMÜ—z’z $Ó'�ô ˜$¤×(Ò(¨T¯Y©Y¸!¬^Ü Ð#<¸T¿Y¹Y¸KÀÐ!WÓXÐXØ×&Ñ& tÐ&Ó9×?Ñ?È)Ð?ÓTˆDà—‘˜TŸ\™\¨4¯9©9°d·k±kðAÑ=ˆDŒK˜œ t¤y°$´+ð ÒÜ% eÓ,ˆD�Kà�z‰zÒ!ð9Ü˜DŸK™KÓ(¨1Õ,�AØŸ™×(Ñ(Ó*¨QÕ.�Að Ÿ.™.‘C�AÜ"-¨q­s°1µ3¨iÓ"8�D”Kà�:‰:ÒØŠ}ä Ð!6Ó7Ð7ä)¨%Ó0�”àÒØŸ	™	×(Ñ(¬°%¿¹Ó)CÈ%Ð(ÓPˆDŒIà×Ñ UÐÖ+øôE ô MÜ Ð!9Ø$(§K¡K =Ð0Cð"Eó FØKLðMûðMûô$ !ô QÜ$Ð%HÓIÈqÐPûðQús0   Ï0V6 Ó=W# Ö6W ×W×W ×#W?×.W:×:W?c                ó   € V P                   w  r#V P                  w  rEV 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                  ^8w  g   V P                  P                  ^8w  d   \        R4      hV P                  P                  ^8w  d   \        R4      h\        V P                  4      W$,          ^,           8w  d3   \        R\        V P                  4       R	W$,          ^,            R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d`   V P                  ^ 8”  d¾   V P                  P                  4       W5,          8¼  d1   \        RW5,           RV P                  P                  4        R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 BSR 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`.
Úiz$indptr array has non-integer dtype (Ú))Ú
stacklevelz%indices array has non-integer dtype (z!indices, and indptr should be 1-Dzdata should be 3-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column index values must be < z
 (now max z column index values must be >= 0z8index pointer values must form a non-decreasing sequencer&   Néÿÿÿÿ)r(   r"   r4   r'   Úkindr   Únamer5   rC   r:   r6   r@   ÚpruneÚnnzr?   Úminr;   Údiffr>   rD   r   )rH   r.   rJ   rK   rL   rM   rN   s   &&     rQ   rG   Ú_bsr_base.check_format�   s¿  € ð �j‰j‰ˆØ�n‰n‰ˆð �;‰;×Ñ×!Ñ! SÔ(ÜÐ7¸¿¹×8IÑ8I×8NÑ8NÐ7OÈqÐQØõà�<‰<×Ñ×"Ñ" cÔ)ÜÐ8¸¿¹×9KÑ9K×9PÑ9PÐ8QÐQRÐSØõð �<‰<×Ñ Ô! T§[¡[×%5Ñ%5¸Ô%:ÜÐ@ÓAÐAØ�9‰9�>‰>˜QÔÜÐ1Ó2Ð2ô �—‘Ó ¥ q¥Ô(ÜØ&¤s¨4¯;©;Ó'7Ð&8¸ÀaÅdÈQÅhÀZÈqÐQóð ð �K‰K˜�N˜aÔÜÐ@ÓAÐAô �—‘Ó¤ T§Y¡Y£Ô/ÜÐIÓJÐJØ�K‰K˜�Oœc $§,¡,Ó/Ô/Üð Dó Eð Eð 	�
‰
Œçˆ:à�x‰x˜!Œ|Ø—<‘<×#Ñ#Ó%¨­Ô-Ü$Ø8¸½¸Ø$ T§\¡\×%5Ñ%5Ó%7Ð$8¸ð;óð ð —<‘<×#Ñ#Ó%¨Ô)Ü$Ð%GÓHÐHÜ—7’7˜4Ÿ;™;Ó'×+Ñ+Ó-°Ô1Ü$ð &Bó Cð Cð ×-Ñ-¨t¯|©|¸T¿[¹[Ð.IÓJˆIÜŸ*š* T§[¡[¸	ÔBˆDŒKÜŸ:š: d§l¡l¸)ÔDˆDŒLÜ! $§)¡)Ó,ˆDŽIñ# ó    c                ó    <€ V ^8„  d   QhRS[ /# )é   Úreturn)r9   )r2   Ú__classdict__s   "€rQ   Ú__annotate__Ú_bsr_base.__annotate__Õ   s   ø€ ÷ #ñ #™5ñ #r_   c                ó<   € V P                   P                  R,          # )zBlock size of the matrix.r+   )r6   r(   )rH   s   &rQ   r"   Ú_bsr_base.blocksizeÔ   s   € ð �y‰y�‰˜rÕ"Ð"r_   c                ó�   € Ve   \        R4      hV P                  w  r#\        V P                  R,          4      V,          V,          # )Nz6_getnnz over an axis is not implemented for BSR formatrW   )ÚNotImplementedErrorr"   Úintr4   )rH   ÚaxisrL   rM   s   &&  rQ   Ú_getnnzÚ_bsr_base._getnnzÙ   sB   € ØÒÜ%ð '7ó 8ð 8à�~‰~‰ˆÜ�4—;‘;˜r•?Ó# aÕ'¨!Õ+Ð+r_   c                óh   € Ve   \        R4      h\        P                  ! V P                  4       4      # )Nz:count_nonzero over axis is not implemented for BSR format.)ri   r;   Úcount_nonzeroÚ_deduped_data)rH   rk   s   &&rQ   ro   Ú_bsr_base.count_nonzeroâ   s4   € ØÒÜ%ØLóð ô ×Ò × 2Ñ 2Ó 4Ó5Ð5r_   c                ó  € \         V P                  ,          w  r\        V \        4      '       d   R MRpRP	                  R V P
                   4       4      pRV RV RV P                   RV P                   RV R	V P                   R
2# )rB   ÚmatrixÚxc              3   ó8   "  € T F  p\        V4      x € K  	  R # 5i©N)Ústr)Ú.0rt   s   & rQ   Ú	<genexpr>Ú%_bsr_base.__repr__.<locals>.<genexpr>î   s   é € Ð4¡^ ”S˜—V�V£^ùs   ‚Ú<z sparse z of dtype 'z'
	with z stored elements (blocksize=z) and shape Ú>)	r   r2   r8   r   Újoinr"   r'   r[   r(   )rH   Ú_ÚfmtÚ
sparse_clsÚbs   &    rQ   Ú__repr__Ú_bsr_base.__repr__ë   s‚   € Ü˜$Ÿ+™+Õ&‰ˆÜ *¨4´× 9Ò 9‘W¸xˆ
Ø�H‰HÑ4 T§^¢^Ó4Ó4ˆà�ˆu�H˜Z˜L¨°D·J±J°<ð @Ø—h‘h�ZÐ;¸A¸3¸lÈ4Ï:É:È,ÐVWðYð	
r_   c                ó  € V P                   w  r#W) 8:  g   W8¼  d-   \        P                  ! ^ V P                  P                  R7      # V P
                  w  rE\        P                  ! \        V\        V^ 4      ,           V\        V^ 4      ,
          4      \        V P                  4      R7      p\        P                  ! WV,          W5,          WEV P                  V P                  \        P                  ! V P                  4      V4	       V# ©r0   r&   )r(   r;   Úemptyr6   r'   r"   r<   r\   r?   r   r   Úbsr_diagonalr4   r5   Úravel)rH   ÚkÚrowsÚcolsrL   rM   Úys   &&     rQ   ÚdiagonalÚ_bsr_base.diagonalô   sµ   € Ø—Z‘Z‰
ˆØ�Œ:˜œÜ—8’8˜A T§Y¡Y§_¡_Ô5Ð5Ø�~‰~‰ˆÜ�HŠH”S˜¤ A q£	Õ)¨4´#°a¸³)Õ+;Ó<Ü! $§*¡*Ó-ô/ˆä×!Ò! !¨Q¥Y°µ	¸1Ø"&§+¡+¨t¯|©|Ü"$§(¢(¨4¯9©9Ó"5°qô	:ð ˆr_   c                ó   € \         hrv   ©ri   )rH   Úkeys   &&rQ   Ú__getitem__Ú_bsr_base.__getitem__  ó   € Ü!Ð!r_   c                ó   € \         hrv   r�   )rH   r‘   Úvals   &&&rQ   Ú__setitem__Ú_bsr_base.__setitem__	  r”   r_   c                óD   € V P                  R R7      P                  V4      # ©Fr-   )ÚtocooÚ
_add_dense)rH   Úothers   &&rQ   rœ   Ú_bsr_base._add_dense  s   € Ø�z‰z˜uˆzÓ%×0Ñ0°Ó7Ð7r_   c                ó^  € V P                   w  r#V P                  w  rE\        P                  ! V P                   ^ ,          \	        V P
                  VP
                  4      R7      p\        W$,          W5,          WEV P                  V P                  V P                  P                  4       W4	       V# r…   )r(   r"   r;   r<   r   r'   r   r4   r5   r6   rˆ   )rH   r�   rJ   rK   rL   rM   Úresults   &&     rQ   Ú_matmul_vectorÚ_bsr_base._matmul_vector  su   € Ø�j‰j‰ˆØ�n‰n‰ˆä—’˜$Ÿ*™* Q�-¬v°d·j±jÀ%Ç+Á+Ó/NÔOˆä�1•4˜�˜qØ�K‰K˜Ÿ™ t§y¡y§¡Ó'8Øô	ð ˆr_   c                ó   € V P                   w  r#V P                  w  rEVP                  ^,          p\        P                  ! WF3\	        V P
                  VP
                  4      R7      p\        WB,          WS,          WbVV P                  V P                  V P                  P                  4       VP                  4       VP                  4       4
       V# )r,   r&   )r"   r(   r;   r<   r   r'   r   r4   r5   r6   rˆ   )rH   r�   rL   rM   rJ   rK   Ún_vecsr    s   &&      rQ   Ú_matmul_multivectorÚ_bsr_base._matmul_multivector  sŒ   € Ø�n‰n‰ˆØ�j‰j‰ˆØ—‘˜Q•ˆä—’˜1˜*¬F°4·:±:¸e¿k¹kÓ,JÔKˆä�A•D˜!�$ ¨1Ø—‘˜TŸ\™\¨4¯9©9¯?©?Ó+<Ø—‘“˜vŸ|™|›~ô	/ð ˆr_   c                ó  € V P                   w  r#VP                   w  rEV P                  w  rgVP                  R 8X  d   VP                  ^,          pM^pVP                  R8X  d   V^8X  d   VP                  Wx3RR7      pMVP                  Wx3R7      pV P	                  V P
                  V P                  VP
                  VP                  34      p	W&,          p
WX,          p\        W«V P
                  P                  V	RR7      V P                  P                  V	RR7      VP
                  P                  V	RR7      VP                  P                  V	RR7      4      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                  ! WÉR7      p\        P                  ! Wh,          V,          \        V P                  VP                  4      R7      p\        WÊW¶W‡V P
                  P                  V	RR7      V P                  P                  V	RR7      \        P                  ! V P                  4      VP
                  P                  V	RR7      VP                  P                  V	RR7      \        P                  ! VP                  4      VVV4       VP!                  R	Wh4      pV P#                  WþV3W%3Wh3R7      # )
r   ÚcsrF)r"   r*   r!   r-   r$   r&   )r(   r"   rW   )r(   r"   r2   r3   r>   r4   r5   r   rF   r;   r†   r   r'   r   rˆ   r6   ÚreshapeÚ_bsr_container)rH   r�   rJ   ÚK1ÚK2rK   rL   ÚnrM   rN   Ún_browÚn_bcolÚbnnzr4   r5   r6   s   &&              rQ   Ú_matmul_sparseÚ_bsr_base._matmul_sparse,  s|  € Ø—
‘
‰ˆØ—‘‰ˆà�n‰n‰ˆð �<‰<˜5Ô Ø—‘ Õ"‰AàˆAà�<‰<˜5Ô  Q¨!¤VØ—K‘K¨1¨%°e�KÓ<‰Eà—K‘K¨1¨%�KÓ0ˆEà×)Ñ)¨4¯;©;¸¿¹Ø+0¯<©<¸¿¹ð+Hó Iˆ	ð •ˆØ•ˆÜ  Ø!%§¡×!3Ñ!3°IÀEÐ!3Ó!JØ!%§¡×!4Ñ!4°YÀUÐ!4Ó!KØ!&§¡×!4Ñ!4°YÀUÐ!4Ó!KØ!&§¡×!5Ñ!5°iÀeÐ!5Ó!Ló	Nˆð ×)Ñ)¨4¯;©;¸¿¹Ø+0¯<©<¸¿¹ð+Hà15ð *ó 7ˆ	ô —’˜$Ÿ+™+×+Ñ+°9Ô=ˆÜ—(’(˜4Ô1ˆÜ�xŠx˜�˜D�¬¨t¯z©z¸%¿+¹+Ó(FÔGˆä�4 ¨AØ—;‘;×%Ñ% i°eÐ%Ó<Ø—<‘<×&Ñ& y°uÐ&Ó=Ü—8’8˜DŸI™IÓ&Ø—<‘<×&Ñ& y°uÐ&Ó=Ø—=‘=×'Ñ'¨	¸Ð'Ó>Ü—8’8˜EŸJ™JÓ'ØØØô		ð �|‰|˜B˜qÓ#ˆð ×"Ñ"Ø˜FÐ#¨A¨6¸a¸Vð #ó 
ð 	
r_   c                óœ   € VRV P                   39  d!   V P                  4       P                  VR7      # V'       d   V P                  4       # V # )a  Convert this array/matrix into Block Sparse Row Format.

With copy=False, the data/indices may be shared between this
array/matrix and the resultant bsr_array/bsr_matrix.

If blocksize=(R, C) is provided, it will be used for determining
block size of the bsr_array/bsr_matrix.
Nr!   )r"   Útocsrr3   r*   )rH   r"   r*   s   &&&rQ   r3   Ú_bsr_base.tobsrf  sC   € ð ˜T 4§>¡>Ð2Ô2Ø—:‘:“<×%Ñ%°	Ð%Ó:Ð:ßØ—9‘9“;ÐàˆKr_   c                ót  € V P                   w  r#V P                  w  rEV P                  pV P                  V P                  V P
                  3\        Wc4      R 7      p\        P                  ! V^,           VR7      p\        P                  ! WgR7      p	\        P                  ! V\        V P                  4      R7      p
\        W$,          W5,          WEV P                  P                  VRR7      V P
                  P                  VRR7      V P                  VV	V
4
       V P                  W©V3V P                   R7      # )r$   r&   Fr-   ©r(   )r(   r"   r[   r>   r4   r5   r?   r;   r†   r   r'   r   rF   r6   Ú_csr_container)rH   r*   rJ   rK   rL   rM   r[   rN   r4   r5   r6   s   &&         rQ   r´   Ú_bsr_base.tocsrv  sú   € Ø�z‰z‰ˆØ�~‰~‰ˆØ�h‰hˆØ×)Ñ)¨4¯;©;¸¿¹Ð*EÜ14°S³ð *ó >ˆ	ä—’˜!˜a�% yÔ1ˆÜ—(’(˜3Ô0ˆÜ�xŠx˜¤6¨$¯*©*Ó#5Ô6ˆä�!•&Ø•&ØØ—+‘+×$Ñ$ Y°UÐ$Ó;Ø—,‘,×%Ñ% i°eÐ%Ó<Ø—)‘)ØØØô	ð ×"Ñ" D°6Ð#:À$Ç*Á*Ð"ÓMÐMr_   c                óF   € V P                  R R7      P                  VR7      # rš   )r´   Útocsc)rH   r*   s   &&rQ   r»   Ú_bsr_base.tocsc�  s!   € Ø�z‰z˜uˆzÓ%×+Ñ+°Ð+Ó6Ð6r_   c                óö  € V P                   w  r#V P                  w  rE\        P                  ! V P                  4      pVP
                  P                  \        P
                  ! \        P                  4      P                  8”  dK   VP                  \        P                  4      p\        P                  ! Wv8g  4      '       d   \        R4      hTpV P                  \        W#4      R7      pV\        P                  ! W$,          VR7      ,          P                  V4      p	V	P                  WE,          4      P                  RWE4      p	V	\        P                   ! \        P                  ! WHR7      P                  R^4      ^V34      ,          p	V	P                  R4      p	WPP"                  ,          P                  VRR7      P                  WE,          4      P                  RWE4      p
V
\        P                   ! \        P                  ! WXR7      V^34      ,          p
V
P                  R4      p
V P$                  P                  R4      pV'       d   VP'                  4       pV P)                  W¹V
33V P                   R7      # )z¡Convert this array/matrix to COOrdinate format.

When copy=False the data array will be shared between
this array/matrix and the resultant coo_array/coo_matrix.
zMatrix too big to convertr$   r&   Fr-   r·   rW   )r(   r"   r;   r]   r4   r'   ÚitemsizeÚintprF   Úanyr:   r>   r?   ÚarangeÚrepeatr©   Útiler5   r6   r*   rA   )rH   r*   rJ   rK   rL   rM   Úindptr_diffÚindptr_diff_limitedrN   ÚrowÚcolr6   s   &&          rQ   r›   Ú_bsr_base.tocoo’  sÊ  € ð �j‰j‰ˆØ�n‰n‰ˆä—g’g˜dŸk™kÓ*ˆØ×Ñ×%Ñ%¬¯ª´·±Ó(9×(BÑ(BÔBà"-×"4Ñ"4´R·W±WÓ"=ÐÜ�vŠvÐ)Ñ8×9Ò9Ü Ð!<Ó=Ð=Ø-ˆKà×)Ñ)´°Q³Ð)Ó;ˆ	Ø”2—9’9˜Q�T¨Ô3Õ3×;Ñ;¸KÓHˆØ�j‰j˜�‹o×%Ñ% b¨Ó-ˆØŒr�wŠw”r—y’y Ô4×<Ñ<¸RÀÓBÀQÀqÀEÓJÕJˆØ�k‰k˜"‹oˆà—L‘LÕ ×(Ñ(¨¸Ð(Ó?ß‘�q•s“ŸG™G B q›Oð 	àŒr�wŠw”r—y’y Ô4°q¸°eÓ<Õ<ˆØ�k‰k˜"‹oˆà�y‰y× Ñ  Ó$ˆçØ—9‘9“;ˆDà×"Ñ"Ø˜�:Ð d§j¡jð #ó 
ð 	
r_   c                óF   € V P                  R R7      P                  WR7      # )Fr-   )ÚorderÚout)r›   Útoarray)rH   rÊ   rË   s   &&&rQ   rÌ   Ú_bsr_base.toarray¸  s!   € Ø�z‰z˜uˆzÓ%×-Ñ-°EÐ-ÓCÐCr_   c                óþ  € Ve   VR8w  d   \        R4      hV P                  w  r4V P                  w  rVV P                  W4,          ,          pV P                  ^ 8X  d"   V P	                  We3WC3V P
                  VR7      # \        P                  ! Wd,          ^,           V P                  P
                  R7      p\        P                  ! WpP                  P
                  R7      p	\        P                  ! WtV3V P                  P
                  R7      p
\        WS,          Wd,          W4V P                  V P                  V P                  P                  4       W‰V
P                  4       4
       V P	                  W©V3We3VR7      # )NzoSparse matrices do not support an 'axes' parameter because swapping dimensions is the only logical permutation.)r"   r'   r*   r&   )r(   r*   )r,   r0   )r:   r"   r(   r[   rª   r'   r;   r†   r4   r5   r6   r   rˆ   )rH   Úaxesr*   rL   rM   rJ   rK   ÚNBLKr4   r5   r6   s   &&&        rQ   Ú	transposeÚ_bsr_base.transpose½  s5  € ØÒ ¨¤Üð Ló Mð Mð �~‰~‰ˆØ�z‰z‰ˆØ�x‰x˜!�#�ˆà�8‰8�qŒ=Ø×&Ñ&¨ v¸!¸Ø-1¯Z©Z¸dð 'ó Dð Dô —’˜!�$ �(¨$¯+©+×*;Ñ*;Ô<ˆÜ—(’(˜4§|¡|×'9Ñ'9Ô:ˆÜ�xŠx˜ !˜¨D¯I©I¯O©OÔ<ˆä�a•d˜A�D !Ø—k‘k 4§<¡<°·±·±Ó1BØ t§z¡z£|ô	5ð ×"Ñ" D°6Ð#:Ø*+¨°dð #ó <ð 	<r_   c                óä  € V P                   '       g   R# V P                  w  rV P                  w  r4V P                  ^ 8g  P	                  RW,          4      P                  ^R7      pVP                  4       ^ ,          pV P                  V,          V P                  R\        V4      % \        P                  ! W1,          WB,          V P                  V P                  V4       V P                  4        R# )zRemove zero elements in-place.N)rk   rW   )r[   r"   r(   r6   r©   ÚsumÚnonzeror@   r   Úcsr_eliminate_zerosr4   r5   rZ   )rH   rL   rM   rJ   rK   ÚmaskÚnonzero_blockss   &      rQ   Úeliminate_zerosÚ_bsr_base.eliminate_zerosÜ  s¯   € ð �x�xˆxÙà�n‰n‰ˆØ�j‰j‰ˆà—	‘	˜Q‘×'Ñ'¨¨1­3Ó/×3Ñ3¸Ð3Ó;ˆàŸ™›¨Õ*ˆà*.¯)©)°NÕ*Cˆ�	‰	Ð&”3�~Ó&Ð'ô 	×(Ò(¨­¨q­t°T·[±[Ø)-¯©°tô	=à�
‰
Žr_   c                óŽ  € V P                   '       d   R# V P                  4        V P                  w  rV P                  w  r4W1,          p^ p^ p\	        V4       FÒ  pTp	V P
                  V^,           ,          pW—8  d™   V P                  V	,          p
V P                  V	,          pV	^,          p	W—8  d=   V P                  V	,          V
8X  d%   W°P                  V	,          ,          pV	^,          p	KB  W P                  V&   W°P                  V&   V^,          pKž  W`P
                  V^,           &   KÔ  	  V P                  4        RV n         R# )zaEliminate duplicate array/matrix entries by adding them together

The is an *in place* operation
NT)	Úhas_canonical_formatÚsort_indicesr"   r(   Úranger4   r5   r6   rZ   )rH   rL   rM   rJ   rK   Ún_rowr[   Úrow_endrT   ÚjjÚjrt   s   &           rQ   Úsum_duplicatesÚ_bsr_base.sum_duplicatesð  s  € ð
 ×$×$Ð$ÙØ×ÑÔØ�~‰~‰ˆØ�z‰z‰ˆð •ˆØˆØˆÜ�u–ˆAØˆBØ—k‘k ! A¥#Õ&ˆGØ”,Ø—L‘L Õ$�Ø—I‘I˜b•M�Ø�a•�Ø”l t§|¡|°BÕ'7¸1Ô'<ØŸ™ 2�Õ&�AØ˜!•G’BØ$%—‘˜SÑ!Ø!"—	‘	˜#‘Ø�q•’Ø"�K‰K˜˜!�Óñ ð 	�
‰
ŒØ$(ˆÖ!r_   c           
     ó  € V P                   '       d   R# V P                  w  rV P                  w  r4\        W1,          WB,          WV P                  V P
                  V P                  P                  4       4       RV n         R# )z9Sort the indices of this array/matrix *in place*
        NT)Úhas_sorted_indicesr"   r(   r   r4   r5   r6   rˆ   )rH   rL   rM   rJ   rK   s   &    rQ   rÝ   Ú_bsr_base.sort_indices  sZ   € ð ×"×"Ð"Ùà�n‰n‰ˆØ�j‰j‰ˆä˜�˜q�t Q¨4¯;©;¸¿¹ÀdÇiÁiÇoÁoÓFWÔXà"&ˆÖr_   c                ó¬  € V P                   w  rV P                  w  r4\        V P                  4      W1,          ^,           8w  d   \	        R4      hV P                  R,          p\        V P
                  4      V8  d   \	        R4      h\        V P                  4      V8  d   \	        R4      hV P                  RV V n        V P
                  RV V n        R# )z8Remove empty space after all non-zero elements.
        z index pointer has invalid lengthz"indices array has too few elementszdata array has too few elementsNrW   )r"   r(   r@   r4   r:   r5   r6   )rH   rL   rM   rJ   rK   r°   s   &     rQ   rZ   Ú_bsr_base.prune  s§   € ð �n‰n‰ˆØ�j‰j‰ˆäˆt�{‰{Ó˜q�t a�xÔ'ÜÐ?Ó@Ð@à�{‰{˜2�ˆäˆt�|‰|Ó˜tÔ#ÜÐAÓBÐBÜˆt�y‰y‹>˜DÔ ÜÐ>Ó?Ð?à—I‘I˜e˜tÐ$ˆŒ	Ø—|‘| E TÐ*ˆŽr_   c                óÈ  € V P                  WP                  R7      p\        \        V P                  V,           V P                  ,           4      pV P                  w  rg\        V P                  4      \        VP                  4      ,           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                  ! W‰R7      p. ROpW,9   d5   \        P                  ! Wg,          V,          \        P                  R7      pMC\        P                  ! Wg,          V,          \        V P                  VP                  4      R7      pV! V P                  ^ ,          V,          V P                  ^,          V,          WgV P                  P!                  V	RR7      V P                  P!                  V	RR7      V P                  VP                  P!                  V	RR7      VP                  P!                  V	RR7      \        P"                  ! VP                  4      V
VV4       V
R	,          pVRV pVRWg,          V,           pWè^,          8  d!   VP%                  4       pVP%                  4       pVP'                  R	Wg4      pV P                  WÛV
3V P                  R7      # )
z5Apply the binary operation fn to two sparse matrices.r!   r$   r&   Fr-   Nr·   )Ú_ne_Ú_lt_Ú_gt_Ú_le_Ú_ge_rW   )Ú	__class__r"   Úgetattrr   r2   r@   r6   r>   r4   r5   r;   r†   r(   Úbool_r   r'   rF   rˆ   r*   r©   )rH   r�   ÚopÚin_shapeÚ	out_shapeÚfnrL   rM   Úmax_bnnzrN   r4   r5   Úbool_opsr6   Úactual_bnnzs   &&&&&          rQ   Ú_binoptÚ_bsr_base._binopt3  s!  € ð
 —‘˜u·±�Ó?ˆô ”\ 4§;¡;°Õ#3°d·k±kÕ#AÓBˆà�n‰n‰ˆä�t—y‘y“>¤C¨¯
©
£OÕ3ˆØ×)Ñ)¨4¯;©;¸¿¹Ø+0¯<©<¸¿¹ð+Hà19ð *ó ;ˆ	ô —’˜$Ÿ+™+×+Ñ+°9Ô=ˆÜ—(’(˜8Ô5ˆâ;ˆØŒ>Ü—8’8˜A�C �L´·±Ô9‰Dä—8’8˜A�C �L´°t·z±zÀ%Ç+Á+Ó0NÔOˆDá
ˆ4�:‰:�a�=˜!Õ˜TŸZ™Z¨�]¨AÕ-¨qØ�;‰;×Ñ˜i¨eÐÓ4Ø�<‰<×Ñ˜y¨uÐÓ5Ø�9‰9Ø�<‰<×Ñ˜y¨uÐÓ5Ø�=‰=×Ñ 	°ÐÓ6Ü�8Š8�E—J‘JÓØØØô		ð ˜R•jˆØ˜,˜;Ð'ˆØÐ$�Q•S˜•_Ð%ˆà !�Ô#Ø—l‘l“nˆGØ—9‘9“;ˆDà�|‰|˜B˜qÓ#ˆà�~‰~˜t¨fÐ5¸T¿Z¹Zˆ~ÓHÐHr_   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      # )z�Returns 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.
)r(   r'   )rð   r5   r*   r4   r(   r'   )rH   r6   r*   s   &&&rQ   Ú
_with_dataÚ_bsr_base._with_datad  sƒ   € ÷
 Ø—>‘> 4¯©×(9Ñ(9Ó(;¸D¿K¹K×<LÑ<LÓ<NÐ"OØ)-¯©¸$¿*¹*ð "ó Fð Fð —>‘> 4¯©°T·[±[Ð"AØ)-¯©¸$¿*¹*ð "ó Fð Fr_   c                ó0   € \         P                  ! WV4      # rv   )r   Ú_broadcast_to)rH   r(   r*   s   &&&rQ   r   Ú_bsr_base._broadcast_tow  s   € Ü×$Ò$ T°$Ó7Ð7r_   )r7   r6   rÜ   ræ   r5   r4   )NNFN)Trv   r/   )NF)F)NN)$Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú_formatr1   rG   Úpropertyr"   rl   r   Ú__doc__ro   r‚   r�   r’   r—   rœ   r¡   r¥   r±   r3   r´   r»   r›   rÌ   rÑ   rÙ   rã   rÝ   rZ   rú   rý   r   Ú__static_attributes__Ú__classdictcell__)rc   s   @rQ   r   r      sB  ø‡ € Ø€Gñs,Ø-1õs,ôj?-ðH ÷#ó ð#ô,ð —o‘o×-Ñ-€G„Oô6ð $×1Ñ1×9Ñ9€MÔò
ô
ð ×'Ñ'×/Ñ/€HÔò"ò"ò8ò
òò4
ôtô Nð* —M‘M×)Ñ)€E„Mô7ð —M‘M×)Ñ)€E„Mô$
ôLDð —o‘o×-Ñ-€G„Oô<ð2  ×)Ñ)×1Ñ1€IÔòò()òB'ò+ô*.Iôb
F÷&8ò 8r_   r   c                ó"   € \        V \        4      # )aŒ  Is `x` of a bsr_matrix type?

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

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

Examples
--------
>>> from scipy.sparse import bsr_array, bsr_matrix, csr_matrix, isspmatrix_bsr
>>> isspmatrix_bsr(bsr_matrix([[5]]))
True
>>> isspmatrix_bsr(bsr_array([[5]]))
False
>>> isspmatrix_bsr(csr_matrix([[5]]))
False
)r8   r   )rt   s   &rQ   Úisspmatrix_bsrr  {  s   € ô. �aœÓ$Ð$r_   c                   ó   € ] tR tRtRtRtR# )r   i–  aŠ  
Block Sparse Row format sparse array.

This can be instantiated in several ways:
    bsr_array(D, [blocksize=(R,C)])
        where D is a 2-D ndarray.

    bsr_array(S, [blocksize=(R,C)])
        with another sparse array or matrix S (equivalent to S.tobsr())

    bsr_array((M, N), [blocksize=(R,C), dtype])
        to construct an empty sparse array with shape (M, N)
        dtype is optional, defaulting to dtype='d'.

    bsr_array((data, ij), [blocksize=(R,C), shape=(M, N)])
        where ``data`` and ``ij`` satisfy ``a[ij[0, k], ij[1, k]] = data[k]``

    bsr_array((data, indices, indptr), [shape=(M, N)])
        is the standard BSR representation where the block column
        indices for row i are stored in ``indices[indptr[i]:indptr[i+1]]``
        and their corresponding block values are stored in
        ``data[ indptr[i]: indptr[i+1] ]``. If the shape parameter is not
        supplied, the array dimensions are inferred from the index arrays.

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
size
data
    BSR format data array of the array
indices
    BSR format index array of the array
indptr
    BSR format index pointer array of the array
blocksize
    Block size
has_sorted_indices : bool
    Whether indices are sorted
has_canonical_format : bool
T

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

**Summary of BSR format**

The Block Sparse Row (BSR) format is very similar to the Compressed
Sparse Row (CSR) format. BSR is appropriate for sparse matrices with dense
sub matrices like the last example below. Such sparse block matrices often
arise in vector-valued finite element discretizations. In such cases, BSR is
considerably more efficient than CSR and CSC for many sparse arithmetic
operations.

**Blocksize**

The blocksize (R,C) must evenly divide the shape of the sparse array (M,N).
That is, R and C must satisfy the relationship ``M % R = 0`` and
``N % C = 0``.

If no blocksize is specified, a simple heuristic is applied to determine
an appropriate blocksize.

**Canonical Format**

In canonical format, there are no duplicate blocks and indices are sorted
per row.

**Limitations**

Block Sparse Row format sparse arrays do not support slicing.

Examples
--------
>>> import numpy as np
>>> from scipy.sparse import bsr_array
>>> bsr_array((3, 4), dtype=np.int8).toarray()
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]], dtype=int8)

>>> row = np.array([0, 0, 1, 2, 2, 2])
>>> col = np.array([0, 2, 2, 0, 1, 2])
>>> data = np.array([1, 2, 3 ,4, 5, 6])
>>> bsr_array((data, (row, col)), shape=(3, 3)).toarray()
array([[1, 0, 2],
       [0, 0, 3],
       [4, 5, 6]])

>>> indptr = np.array([0, 2, 3, 6])
>>> indices = np.array([0, 2, 2, 0, 1, 2])
>>> data = np.array([1, 2, 3, 4, 5, 6]).repeat(4).reshape(6, 2, 2)
>>> bsr_array((data,indices,indptr), shape=(6, 6)).toarray()
array([[1, 1, 0, 0, 2, 2],
       [1, 1, 0, 0, 2, 2],
       [0, 0, 0, 0, 3, 3],
       [0, 0, 0, 0, 3, 3],
       [4, 4, 5, 5, 6, 6],
       [4, 4, 5, 5, 6, 6]])

© N©r  r  r  r  r  r	  r  r_   rQ   r   r   –  ó   † õkr_   c                   ó   € ] tR tRtRtRtR# )r   i  a   
Block Sparse Row format sparse matrix.

This can be instantiated in several ways:
    bsr_matrix(D, [blocksize=(R,C)])
        where D is a 2-D ndarray.

    bsr_matrix(S, [blocksize=(R,C)])
        with another sparse array or matrix S (equivalent to S.tobsr())

    bsr_matrix((M, N), [blocksize=(R,C), dtype])
        to construct an empty sparse matrix with shape (M, N)
        dtype is optional, defaulting to dtype='d'.

    bsr_matrix((data, ij), [blocksize=(R,C), shape=(M, N)])
        where ``data`` and ``ij`` satisfy ``a[ij[0, k], ij[1, k]] = data[k]``

    bsr_matrix((data, indices, indptr), [shape=(M, N)])
        is the standard BSR representation where the block column
        indices for row i are stored in ``indices[indptr[i]:indptr[i+1]]``
        and their corresponding block values are stored in
        ``data[ indptr[i]: indptr[i+1] ]``. If the shape parameter is not
        supplied, the matrix dimensions are inferred from the index arrays.

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
size
data
    BSR format data array of the matrix
indices
    BSR format index array of the matrix
indptr
    BSR format index pointer array of the matrix
blocksize
    Block size
has_sorted_indices : bool
    Whether indices are sorted
has_canonical_format : bool
T

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

**Summary of BSR format**

The Block Sparse Row (BSR) format is very similar to the Compressed
Sparse Row (CSR) format. BSR is appropriate for sparse matrices with dense
sub matrices like the last example below. Such sparse block matrices often
arise in vector-valued finite element discretizations. In such cases, BSR is
considerably more efficient than CSR and CSC for many sparse arithmetic
operations.

**Blocksize**

The blocksize (R,C) must evenly divide the shape of the sparse matrix (M,N).
That is, R and C must satisfy the relationship ``M % R = 0`` and
``N % C = 0``.

If no blocksize is specified, a simple heuristic is applied to determine
an appropriate blocksize.

**Canonical Format**

In canonical format, there are no duplicate blocks and indices are sorted
per row.

**Limitations**

Block Sparse Row format sparse matrices do not support slicing.

Examples
--------
>>> import numpy as np
>>> from scipy.sparse import bsr_matrix
>>> bsr_matrix((3, 4), dtype=np.int8).toarray()
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]], dtype=int8)

>>> row = np.array([0, 0, 1, 2, 2, 2])
>>> col = np.array([0, 2, 2, 0, 1, 2])
>>> data = np.array([1, 2, 3 ,4, 5, 6])
>>> bsr_matrix((data, (row, col)), shape=(3, 3)).toarray()
array([[1, 0, 2],
       [0, 0, 3],
       [4, 5, 6]])

>>> indptr = np.array([0, 2, 3, 6])
>>> indices = np.array([0, 2, 2, 0, 1, 2])
>>> data = np.array([1, 2, 3, 4, 5, 6]).repeat(4).reshape(6, 2, 2)
>>> bsr_matrix((data,indices,indptr), shape=(6, 6)).toarray()
array([[1, 1, 0, 0, 2, 2],
       [1, 1, 0, 0, 2, 2],
       [0, 0, 0, 0, 3, 3],
       [0, 0, 0, 0, 3, 3],
       [4, 4, 5, 5, 6, 6],
       [4, 4, 5, 5, 6, 6]])

r  Nr  r  r_   rQ   r   r     r  r_   )r   r   r  ))r  Ú__docformat__Ú__all__Úwarningsr   Únumpyr;   Úscipy._lib._utilr   Ú_matrixr   Ú_datar   r   Ú_compressedr	   Ú_baser
   r   r   r   Ú_sputilsr   r   r   r   r   r   Ú r   r   r   r   r   r   r   r   r   r  r   r   r  r_   rQ   Ú<module>r     s}   ðÙ (à%€â
7€å ã å +Ý ß .Ý #ß 7Ó 7÷$÷ $å ÷&÷ &ñ &ô
`	8�
˜Mô `	8òF%ô6l�	˜7ô lô^l�˜9ö lr_   