
    #
3j
                     6    S SK rS SKJrJrJr  S SKJr  SS jrg)    N)vec_vec_dotmat_vec_dotvec_vec_outer)	boxfilterc           	        ^ ^^^^^^^ T R                  [        R                  5      m ST-  S-   nXD-  nT R                  u  mmn[	        T TSS9U-  n[	        [        T T 5      TSS9U-  nU[        Xw5      -  n[        R                  R                  XU-  [        R                  " U5      -  -   5      U-  m[        TU5      mSU-  [        UT5      -   m[	        [        R                  " TST-  -
  TST-  -
  45      TSS9mUUUUU UUU4S jn	U(       aT  [	        ST-
  TSS9n
S[	        TTSS9-  nU[        [	        TTSS9T 5      -  nU
[        T U5      -  n
XR                  5       4$ U	$ )a  Calculates the Laplacian for large kernel matting :cite:`he2010fast`

Parameters
----------
image: numpy.ndarray
    Image of shape :math:`h\times w \times 3`
epsilons: float
    Regularization strength, defaults to :math:`10^{-7}`
radius: int
    Radius of local window size, defaults to :math:`10`, i.e. only adjacent
    pixels are considered. The size of the local window is given as
    :math:`(2 r + 1)^2`, where :math:`r` denotes the radius. A larger radius
    might lead to violated color line constraints, but also favors further
    propagation of information within the image.
return_diagonal: bool
    Whether to also return the diagonal of the laplacian, defaults to True

Returns
-------
L_matvec: function
    Function that applies the Laplacian matrix to a vector
diag_L: numpy.ndarray
    Diagonal entries of the matting Laplacian, only returns if
    `return_diagonal` is True
      validmodefullc           
      x  > U R                  TT5      n [        U TSS9n[        U S S 2S S 2[        R                  4   T	-  TSS9nTU -  nUS S 2S S 2[        R                  4   T-  [	        TU5      -
  nU[        T	[        UTSS95      -  nUT
-  [        UT5      -
  nU[        UTSS9-  nUR                  5       $ )Nr
   r   r   )reshaper   npnewaxisr   r   flatten)pp_sumspI_sumsp_LtempVVmchimagemVmradiusws        [/home/wildlama/miniconda3/lib/python3.13/site-packages/pymatting/laplacian/lkm_laplacian.pyL_matveclkm_laplacian.<locals>.L_matvec3   s    IIaO1f73AaBJJ./%7gN!eaBJJ&'",{1g/FF{5)D&v"FGG|k'266yvF33{{}    g      ?)astyper   float64shaper   r   linalginveyer   r   onesr   )r   epsilonr   return_diagonalwindow_sizewindow_areadepthmeanscovsr!   diag_Lr   r   r   r   r   r   r   s   ` `         @@@@@@r    lkm_laplacianr3      sj   4 LL$Ef*q.K+K++KAq% eV'2[@E ]5%0&wG+UDM%''D 			d{2RVVE]BBCkQA	Q	B
k/Kr2
2C"''1q6z>1q6z>:;V&QA   39f6:9Rf55Iaf=uEE+eT**)))Or#   )gHz>
   T)	numpyr   pymatting.util.utilr   r   r   pymatting.util.boxfilterr   r3    r#   r    <module>r9      s     G G .Fr#   