+
    ùª¨jæ‰  ã                   ó    € ^ RI t^ RIHt ^ RIHtHtHt R.t ! R R]4      t	 ! R R]4      t
 ! R R	]4      t ! R
 R]4      t ! R R4      tR# )é    N)ÚLinearOperator)ÚkronÚ	eye_arrayÚ	dia_arrayÚLaplacianNdc                   ó    a a€ ] tR t^
t oRtRRR]P                  /V 3R lltR tRR lt	R t
R	 tRR
 ltR tR tR tR tR tR tRtVtV ;t# )r   aI  
The grid Laplacian in ``N`` dimensions and its eigenvalues/eigenvectors.

Construct Laplacian on a uniform rectangular grid in `N` dimensions
and output its eigenvalues and eigenvectors.
The Laplacian ``L`` is square, negative definite, real symmetric array
with signed integer entries and zeros otherwise.

Parameters
----------
grid_shape : tuple
    A tuple of integers of length ``N`` (corresponding to the dimension of
    the Lapacian), where each entry gives the size of that dimension. The
    Laplacian matrix is square of the size ``np.prod(grid_shape)``.
boundary_conditions : {'neumann', 'dirichlet', 'periodic'}, optional
    The type of the boundary conditions on the boundaries of the grid.
    Valid values are ``'dirichlet'`` or ``'neumann'``(default) or
    ``'periodic'``.
dtype : dtype
    Numerical type of the array. Default is ``np.int8``.

Methods
-------
toarray()
    Construct a dense array from Laplacian data
tosparse()
    Construct a sparse array from Laplacian data
eigenvalues(m=None)
    Construct a 1D array of `m` largest (smallest in absolute value)
    eigenvalues of the Laplacian matrix in ascending order.
eigenvectors(m=None):
    Construct the array with columns made of `m` eigenvectors (``float``)
    of the ``Nd`` Laplacian corresponding to the `m` ordered eigenvalues.

.. versionadded:: 1.12.0

Notes
-----
Compared to the MATLAB/Octave implementation [1] of 1-, 2-, and 3-D
Laplacian, this code allows the arbitrary N-D case and the matrix-free
callable option, but is currently limited to pure Dirichlet, Neumann or
Periodic boundary conditions only.

The Laplacian matrix of a graph (`scipy.sparse.csgraph.laplacian`) of a
rectangular grid corresponds to the negative Laplacian with the Neumann
conditions, i.e., ``boundary_conditions = 'neumann'``.

All eigenvalues and eigenvectors of the discrete Laplacian operator for
an ``N``-dimensional  regular grid of shape `grid_shape` with the grid
step size ``h=1`` are analytically known [2].

References
----------
.. [1] https://github.com/lobpcg/blopex/blob/master/blopex_tools/matlab/laplacian/laplacian.m
.. [2] "Eigenvalues and eigenvectors of the second derivative", Wikipedia
       https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors_of_the_second_derivative

Examples
--------
>>> import numpy as np
>>> from scipy.sparse.linalg import LaplacianNd
>>> from scipy.sparse import diags_array, csgraph
>>> from scipy.linalg import eigvalsh

The one-dimensional Laplacian demonstrated below for pure Neumann boundary
conditions on a regular grid with ``n=6`` grid points is exactly the
negative graph Laplacian for the undirected linear graph with ``n``
vertices using the sparse adjacency matrix ``G`` represented by the
famous tri-diagonal matrix:

>>> n = 6
>>> G = diags_array(np.ones(n - 1), offsets=1, format='csr')
>>> Lf = csgraph.laplacian(G, symmetrized=True, form='function')
>>> grid_shape = (n, )
>>> lap = LaplacianNd(grid_shape, boundary_conditions='neumann')
>>> np.array_equal(lap.matmat(np.eye(n)), -Lf(np.eye(n)))
True

Since all matrix entries of the Laplacian are integers, ``'int8'`` is
the default dtype for storing matrix representations.

>>> lap.tosparse()
<DIAgonal sparse array of dtype 'int8'
    with 16 stored elements (3 diagonals) and shape (6, 6)>
>>> lap.toarray()
array([[-1,  1,  0,  0,  0,  0],
       [ 1, -2,  1,  0,  0,  0],
       [ 0,  1, -2,  1,  0,  0],
       [ 0,  0,  1, -2,  1,  0],
       [ 0,  0,  0,  1, -2,  1],
       [ 0,  0,  0,  0,  1, -1]], dtype=int8)
>>> np.array_equal(lap.matmat(np.eye(n)), lap.toarray())
True
>>> np.array_equal(lap.tosparse().toarray(), lap.toarray())
True

Any number of extreme eigenvalues and/or eigenvectors can be computed.

>>> lap = LaplacianNd(grid_shape, boundary_conditions='periodic')
>>> lap.eigenvalues()
array([-4., -3., -3., -1., -1.,  0.])
>>> lap.eigenvalues()[-2:]
array([-1.,  0.])
>>> lap.eigenvalues(2)
array([-1.,  0.])
>>> lap.eigenvectors(1)
array([[0.40824829],
       [0.40824829],
       [0.40824829],
       [0.40824829],
       [0.40824829],
       [0.40824829]])
>>> lap.eigenvectors(2)
array([[ 0.28867513,  0.40824829],
       [ 0.57735027,  0.40824829],
       [ 0.28867513,  0.40824829],
       [-0.28867513,  0.40824829],
       [-0.57735027,  0.40824829],
       [-0.28867513,  0.40824829]])
>>> lap.eigenvectors()
array([[ 0.40824829,  0.5       ,  0.28867513,  0.28867513,  0.5       ,
         0.40824829],
       [-0.40824829,  0.        , -0.57735027,  0.57735027,  0.        ,
         0.40824829],
       [ 0.40824829, -0.5       ,  0.28867513,  0.28867513, -0.5       ,
         0.40824829],
       [-0.40824829,  0.5       ,  0.28867513, -0.28867513, -0.5       ,
         0.40824829],
       [ 0.40824829,  0.        , -0.57735027, -0.57735027,  0.        ,
         0.40824829],
       [-0.40824829, -0.5       ,  0.28867513, -0.28867513,  0.5       ,
         0.40824829]])

The two-dimensional Laplacian is illustrated on a regular grid with
``grid_shape = (2, 3)`` points in each dimension.

>>> grid_shape = (2, 3)
>>> n = np.prod(grid_shape)

Numeration of grid points is as follows:

>>> np.arange(n).reshape(grid_shape + (-1,))
array([[[0],
        [1],
        [2]],
<BLANKLINE>
       [[3],
        [4],
        [5]]])

Each of the boundary conditions ``'dirichlet'``, ``'periodic'``, and
``'neumann'`` is illustrated separately; with ``'dirichlet'``

>>> lap = LaplacianNd(grid_shape, boundary_conditions='dirichlet')
>>> lap.tosparse()
<Compressed Sparse Row sparse array of dtype 'int8'
    with 20 stored elements and shape (6, 6)>
>>> lap.toarray()
array([[-4,  1,  0,  1,  0,  0],
       [ 1, -4,  1,  0,  1,  0],
       [ 0,  1, -4,  0,  0,  1],
       [ 1,  0,  0, -4,  1,  0],
       [ 0,  1,  0,  1, -4,  1],
       [ 0,  0,  1,  0,  1, -4]], dtype=int8)
>>> np.array_equal(lap.matmat(np.eye(n)), lap.toarray())
True
>>> np.array_equal(lap.tosparse().toarray(), lap.toarray())
True
>>> lap.eigenvalues()
array([-6.41421356, -5.        , -4.41421356, -3.58578644, -3.        ,
       -1.58578644])
>>> eigvals = eigvalsh(lap.toarray().astype(np.float64))
>>> np.allclose(lap.eigenvalues(), eigvals)
True
>>> np.allclose(lap.toarray() @ lap.eigenvectors(),
...             lap.eigenvectors() @ np.diag(lap.eigenvalues()))
True

with ``'periodic'``

>>> lap = LaplacianNd(grid_shape, boundary_conditions='periodic')
>>> lap.tosparse()
<Compressed Sparse Row sparse array of dtype 'int8'
    with 24 stored elements and shape (6, 6)>
>>> lap.toarray()
    array([[-4,  1,  1,  2,  0,  0],
           [ 1, -4,  1,  0,  2,  0],
           [ 1,  1, -4,  0,  0,  2],
           [ 2,  0,  0, -4,  1,  1],
           [ 0,  2,  0,  1, -4,  1],
           [ 0,  0,  2,  1,  1, -4]], dtype=int8)
>>> np.array_equal(lap.matmat(np.eye(n)), lap.toarray())
True
>>> np.array_equal(lap.tosparse().toarray(), lap.toarray())
True
>>> lap.eigenvalues()
array([-7., -7., -4., -3., -3.,  0.])
>>> eigvals = eigvalsh(lap.toarray().astype(np.float64))
>>> np.allclose(lap.eigenvalues(), eigvals)
True
>>> np.allclose(lap.toarray() @ lap.eigenvectors(),
...             lap.eigenvectors() @ np.diag(lap.eigenvalues()))
True

and with ``'neumann'``

>>> lap = LaplacianNd(grid_shape, boundary_conditions='neumann')
>>> lap.tosparse()
<Compressed Sparse Row sparse array of dtype 'int8'
    with 20 stored elements and shape (6, 6)>
>>> lap.toarray()
array([[-2,  1,  0,  1,  0,  0],
       [ 1, -3,  1,  0,  1,  0],
       [ 0,  1, -2,  0,  0,  1],
       [ 1,  0,  0, -2,  1,  0],
       [ 0,  1,  0,  1, -3,  1],
       [ 0,  0,  1,  0,  1, -2]], dtype=int8)
>>> np.array_equal(lap.matmat(np.eye(n)), lap.toarray())
True
>>> np.array_equal(lap.tosparse().toarray(), lap.toarray())
True
>>> lap.eigenvalues()
array([-5., -3., -3., -2., -1.,  0.])
>>> eigvals = eigvalsh(lap.toarray().astype(np.float64))
>>> np.allclose(lap.eigenvalues(), eigvals)
True
>>> np.allclose(lap.toarray() @ lap.eigenvectors(),
...             lap.eigenvectors() @ np.diag(lap.eigenvalues()))
True

Úboundary_conditionsÚneumannÚdtypec               óž   <€ VR9  d   \        RV: R24      hWn        W n        \        P                  ! V4      p\
        SV `  W4V3R7       R# )Ú	dirichletzUnknown value zv is given for 'boundary_conditions' parameter. The valid options are 'dirichlet', 'periodic', and 'neumann' (default).©r   ÚshapeN)r   r
   Úperiodic)Ú
ValueErrorÚ
grid_shaper	   ÚnpÚprodÚsuperÚ__init__)Úselfr   r	   r   ÚNÚ	__class__s   &&$$ €ÚfC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\scipy\sparse\linalg\_special_sparse_arrays.pyr   ÚLaplacianNd.__init__õ   s_   ø€ ð Ð&JÔJÜØ Ð!4Ñ 7ð 8Dð Dóð ð %ŒØ#6Ô ä�GŠG�JÓˆÜ‰Ñ˜u°¨FÐÖ3ó    c           
     óP  € V P                   pVf.   \        P                  ! V4      p\        P                  ! V4      pM\\	        V\        \        P                  ! V4      V,          4      4      p\        P                  ! V4      p\        P                  ! V4      p\        W24       EF?  w  rgV P                  R8X  d_   VR\        P                  ! \        P                  V^,           ,          ^V^,           ,          ,          4      ^,          ,          ,          pKu  V P                  R8X  dQ   VR\        P                  ! \        P                  V,          ^V,          ,          4      ^,          ,          ,          pKÖ  VR\        P                  ! \        P                  \        P                  ! V^,           ^,          4      ,          V,          4      ^,          ,          ,          pEKB  	  VP                  4       p\        P                  ! V4      p	W‰,          p
Ve   W¡) R p
W‘) R p	W©3# )z�Compute `m` largest eigenvalues in each of the ``N`` directions,
i.e., up to ``m * N`` total, order them and return `m` largest.
Nr   r
   éüÿÿÿ)r   r   ÚindicesÚzerosÚminÚtupleÚ	ones_likeÚzipr	   ÚsinÚpiÚfloorÚravelÚargsort)r   Úmr   r   ÚLeigÚgrid_shape_minÚjÚnÚ
Leig_ravelÚindÚeigenvaluess   &&         r   Ú_eigenvalue_orderingÚ LaplacianNd._eigenvalue_ordering  s�  € ð —_‘_ˆ
ØŠ9Ü—j’j Ó,ˆGÜ—8’8˜JÓ'‰Dä  Ü!&¤r§|¢|°JÓ'?À!Õ'CÓ!DóFˆNä—j’j Ó0ˆGÜ—8’8˜NÓ+ˆDä˜×,‰DˆAØ×'Ñ'¨;Ô6Ø˜œRŸVšV¤B§E¡E¨Q°­U¥O°q¸AÀ½Eµ{Õ$CÓDÈÕIÕIÕI’Ø×)Ñ)¨YÔ6Ø˜œRŸVšV¤B§E¡E¨A¥I°°QµÕ$7Ó8¸AÕ=Õ=Õ=’à˜œRŸVšV¤B§E¡E¬B¯HªH°a¸!µe¸qµ[Ó,AÕ$AÀAÕ$EÓFÈ!ÕKÕKÕK“ñ -ð —Z‘Z“\ˆ
Ü�jŠj˜Ó$ˆØ •oˆØŠ=Ø% b cÐ*ˆKØ�b�c�(ˆCàÐÐr   c                ó,   € V P                  V4      w  r#V# )a>  Return the requested number of eigenvalues.

Parameters
----------
m : int, optional
    The positive number of smallest eigenvalues to return.
    If not provided, then all eigenvalues will be returned.

Returns
-------
eigenvalues : float array
    The requested `m` smallest or all eigenvalues, in ascending order.
)r2   )r   r*   r1   Ú_s   &&  r   r1   ÚLaplacianNd.eigenvalues%  s   € ð ×2Ñ2°1Ó5‰ˆØÐr   c                óR  € V P                   R8X  d�   \        P                  \        P                  ! V4      ^,           ,          V^,           ,          p\        P                  ! RVR,           ,          4      \        P
                  ! W1^,           ,          4      ,          pEM?V P                   R8X  dƒ   \        P                  \        P                  ! V4      R,           ,          V,          p\        P                  ! V^ 8X  d   RMRV,          4      \        P                  ! W1,          4      ,          pEM¬V^ 8X  d;   \        P                  ! RV,          4      \        P                  ! V4      ,          pEMkV^,           V8X  dS   V^,          ^ 8X  dE   \        P                  ! RV,          4      \        P                  ! ^R.V^,          4      ,          pEMV^,           ^,          ^ 8X  d€   \        P                  \        P                  ! V4      R,           ,          V,          p\        P                  ! RV,          4      \        P
                  ! W1^,           ,          4      ,          pMw\        P                  \        P                  ! V4      R,           ,          V,          p\        P                  ! RV,          4      \        P                  ! W1,          4      ,          pRV\        P                  ! V4      \        P                  ! \        P                  4      P                  8  &   V# )zYReturn 1 eigenvector in 1d with index `j`
and number of grid points `n` where ``j < n``.
r   g       @ç      ð?r
   ç      à?g        éÿÿÿÿ)r	   r   r&   ÚarangeÚsqrtr%   ÚcosÚonesÚtileÚabsÚfinfoÚfloat64Úeps)r   r-   r.   ÚiÚevs   &&&  r   Ú_ev1dÚLaplacianNd._ev1d6  sá  € ð ×#Ñ# {Ô2Ü—‘œŸš 1›¨Õ)Õ*¨a°!­eÕ4ˆAÜ—’˜˜q 2�v�Ó'¬"¯&ª&°¸!µeµÓ*=Õ=ŠBØ×%Ñ%¨Ô2Ü—‘œŸš 1›¨Õ+Õ,¨qÕ0ˆAÜ—’  Q¤™"¨B°!Õ3Ó4´r·v²v¸a½e³}ÕDŠBà�AŒvÜ—W’W˜R !�V“_¤r§w¢w¨q£zÕ1’Ø�Q•˜!”  A¥¨¤
Ü—W’W˜R !�V“_¤r§w¢w°°2¨w¸¸1½Ó'=Õ=’Ø�a•%˜1• Ô!Ü—E‘EœRŸYšY q›\¨CÕ/Õ0°1Õ4�Ü—W’W˜R !�V“_¤r§v¢v¨a°qµ5­kÓ':Õ:‘ä—E‘EœRŸYšY q›\¨CÕ/Õ0°1Õ4�Ü—W’W˜R !�V“_¤r§v¢v¨a­e£}Õ4�ð 57ˆŒ2�6Š6�"‹:œŸš¤§¡Ó,×0Ñ0Ñ0Ñ1Øˆ	r   c                ó&  € \        WP                  4       UUu. uF  w  r#V P                  W#4      NK  	  pppV^ ,          pVR,           F  p\        P                  ! WT^ R7      pK  	  \        P
                  ! V4      P                  4       # u uppi )zjReturn 1 eigenvector in Nd with multi-index `j`
as a tensor product of the corresponding 1d eigenvectors.
ºé   NN)Úaxes)r$   r   rF   r   Ú	tensordotÚasarrayr(   )r   Úkr-   r.   ÚphiÚresults   &&    r   Ú_one_eveÚLaplacianNd._one_eveP  su   € ô -0°·?±?Ô,CÔDÑ,C¡D Aˆt�z‰z˜!ÖÑ,CˆÑDØ�Q•ˆØ�r—7�7ˆCÜ—\’\ &°AÔ6ŠFñ ä�zŠz˜&Ó!×'Ñ'Ó)Ð)ùó	 Es   ™Bc                ó¾  € V P                  V4      w  r#Vf   V P                  pMD\        V P                  \        \        P
                  ! V P                  4      V,          4      4      p\        P                  ! W44      p\        V!   Uu. uF  p\        V4      NK  	  ppV Uu. uF  qpP                  V4      NK  	  pp\        P                  ! V4      # u upi u upi )a™  Return the requested number of eigenvectors for ordered eigenvalues.

Parameters
----------
m : int, optional
    The positive number of eigenvectors to return. If not provided,
    then all eigenvectors will be returned.

Returns
-------
eigenvectors : float array
    An array with columns made of the requested `m` or all eigenvectors.
    The columns are ordered according to the `m` ordered eigenvalues.
)
r2   r   r!   r"   r   r#   Úunravel_indexr$   rQ   Úcolumn_stack)	r   r*   r5   r0   r,   Ú	N_indicesÚxrN   Úeigenvectors_lists	   &&       r   ÚeigenvectorsÚLaplacianNd.eigenvectorsZ  s±   € ð ×*Ñ*¨1Ó-‰ˆØŠ9Ø!Ÿ_™_‰Nä  §¡Ü %¤b§l¢l°4·?±?Ó&CÀaÕ&GÓ HóJˆNô ×$Ò$ SÓ9ˆ	Ü'*¨I¢Ó7¡ !”U˜1–X¡ˆ	Ð7Ù7@ÓA±y°!Ÿ]™]¨1Ö-±yÐÐAÜ�ŠÐ0Ó1Ð1ùò 8ùÚAs   Â
CÂ$Cc           
     ó°  € V P                   p\        P                  ! V4      p\        P                  ! W".\        P                  R7      p\        P
                  ! V4      p\        P
                  ! V4      p\        V4       EF2  w  rg^ VR&   R\        P                  ! RVRV1RV13,          4      R&   ^\        P                  ! RVRV^,
          1^V13,          4      R&   ^\        P                  ! RV^V1RV^,
          13,          4      R&   V P                  R8X  d   RVR	&   RWG^,
          V^,
          3&   MiV P                  R8X  dY   V^8”  d=   V^ V^,
          3;;,          ^,          uu&   WG^,
          ^ 3;;,          ^,          uu&   MVR	;;,          ^,          uu&   TpV^ 8”  du   \        P                  ! VRV 4      p	\        ^V	4       FK  p
VRV1RV13,          WJV,          V
^,           V,          1W§,          V
^,           V,          13&   W‡,          pKM  	  VRV1RV13,          VRV1RV13&   \        \        P                  ! W^,           R 4      4      p	^ VRV1RV13&   \        V	4       Uu. uF  q»NK  	  ppVRV1RV13,          VP                  W‰W‰34      RVRV3&   W4,          pEK5  	  VP                  V P                  4      # u upi )
zŒ
Converts the Laplacian data to a dense array.

Returns
-------
L : ndarray
    The shape is ``(N, N)`` where ``N = np.prod(grid_shape)``.

©r   ºNNNzii->iNr
   r   éþÿÿÿr:   ©r   r   )r   r   r   r    Úint8Ú
empty_likeÚ	enumerateÚeinsumr	   ÚrangeÚintÚreshapeÚastyper   )r   r   r.   ÚLÚL_iÚLtempr0   ÚdimÚnew_dimÚtilesr-   rW   Úidxs   &            r   ÚtoarrayÚLaplacianNd.toarrayu  s®  € ð —_‘_ˆ
Ü�GŠG�JÓˆÜ�HŠH�a�V¤2§7¡7Ô+ˆä�mŠm˜AÓˆÜ—’˜aÓ ˆä! *×-‰HˆCàˆC�‰Fð 68ŒB�IŠI�g˜s 4 C 4¨¨#¨ :�Ó/°Ñ2Ø;<ŒB�IŠI�g˜s 9 S¨1¥W 9¨a°¨eÐ#3Õ4Ó5°aÑ8Ø;<ŒB�IŠI�g˜s 1 S 5¨)¨C°!­G¨)Ð#3Õ4Ó5°aÑ8à×'Ñ'¨9Ô4Ø��D‘	Ø(*�˜!•G˜S 1�WÐ$Ò%Ø×)Ñ)¨ZÔ7Ø˜”7Ø˜˜3 �7˜
—O qÕ(“OØ˜a� ˜
—O qÕ(”Oà˜—I •N“Ið ˆGà�QŒwÜŸš 
¨4¨CÐ 0Ó1�Ü˜q %ž�AØ<?ÀÀÀÀdÀsÀdÀ
½O�C˜#�˜q �s C�i˜¨­°°!µ°S­y¨Ð8Ñ9Ø•N’Gñ )ð
 ),¨H¨W¨H°h°w°hÐ,>Õ(?ˆE�(�7�(˜H˜W˜HÐ$Ñ%ÜœŸš 
¨q­5¨6Ð 2Ó3Ó4ˆEà&'ˆC���˜(˜7˜(Ð"Ñ#Ü# EœlÓ+™l˜’1™lˆCÐ+ð %*¨(¨7¨(°H°W°HÐ*<Õ$=ð �K‰KØØð!óð �S˜!˜S�.ñ"ð
 �H‹AñW .ðZ �x‰x˜Ÿ
™
Ó#Ð#ùò ,s   É8
Kc           
     ó2  € \        V P                  4      p\        P                  ! V P                  4      p\	        W"3\        P
                  R7      p\        V4       EFœ  pV P                  V,          p\        P                  ! ^V.\        P
                  R7      pVR;;,          R,          uu&   V P                  R8X  d   RVR	&   RVR
&   \	        V. RO3WU3\        P
                  R7      pV P                  R8X  d\   \	        WU3\        P
                  R7      pVP                  ^.V) ^,           R7       VP                  ^.V^,
          R7       Wx,          p\        V4       F9  p	\        \        V P                  V	,          \        P
                  R7      V4      pK;  	  \        V^,           V4       F9  p	\        V\        V P                  V	,          \        P
                  R7      4      pK;  	  W7,          pEKŸ  	  VP                  V P                  4      # )zñ
Constructs a sparse array from the Laplacian data. The returned sparse
array format is dependent on the selected boundary conditions.

Returns
-------
L : scipy.sparse.sparray
    The shape is ``(N, N)`` where ``N = np.prod(grid_shape)``.

r\   r
   )r   r   r   )rN   ©rJ   r]   r^   r:   ©rJ   r   )rJ   r:   ©r:   r   rJ   )Úlenr   r   r   r   r`   rd   r>   r	   Úsetdiagr   r   rg   r   )
r   r   Úprh   rD   rk   Údatari   Útr-   s
   &         r   ÚtosparseÚLaplacianNd.tosparseµ  s‰  € ô �—‘Ó ˆÜ�GŠG�D—O‘OÓ$ˆÜ�q�f¤B§G¡GÔ,ˆä�q—ˆAØ—/‘/ !Õ$ˆCÜ—7’7˜A˜s˜8¬2¯7©7Ô3ˆDØ��J˜"Õ‹Jà×'Ñ'¨9Ô4Ø��T‘
Ø ��U‘ä˜T¢:Ð.°s°jÜ"$§'¡'ôˆCð ×'Ñ'¨:Ô5Ü˜s˜j´·±Ô8�Ø—	‘	˜1˜# #  a¥�	Ô(Ø—	‘	˜1˜#  Q¥�	Ô'Ø•�ä˜1–X�Üœ9 T§_¡_°QÕ%7¼r¿w¹wÔGÈÓM’ñ ä˜1˜q�5 !–_�Ü˜3¤	¨$¯/©/¸!Õ*<ÄBÇGÁGÔ LÓM’ñ %à�H‹Añ/ ð0 �x‰x˜Ÿ
™
Ó#Ð#r   c           
     ó$  € V P                   p\        V4      pVP                  VR,           4      pRV,          V,          p\        V4       EF  pV\        P
                  ! V^VR7      ,          pV\        P
                  ! VRVR7      ,          pV P                  R9   g   KW  V\        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ;;,          \        P
                  ! V^VR7      \        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ,          ,          uu&   V\        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ;;,          \        P
                  ! VRVR7      \        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ,          ,          uu&   V P                  R8X  g   EKÅ  V\        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ;;,          \        P
                  ! V^ VR7      \        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ,          ,          uu&   V\        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ;;,          \        P
                  ! V^ VR7      \        R4      3V,          R,           \        R4      3W6,
          ^,
          ,          ,           ,          ,          uu&   EK"  	  VP                  RVP                  R,          4      # )	rJ   )Úaxisr
   Nr:   )r:   r^   )r
   r   )r   )	r   ru   rf   rd   r   Úrollr	   Úslicer   )r   rW   r   r   ÚXÚYrD   s   &&     r   Ú_matvecÚLaplacianNd._matvecÞ  s‘  € Ø—_‘_ˆ
Ü�
‹OˆØ�I‰I�j 5Õ(Ó)ˆØ��F�Q�JˆÜ�q—ˆAØ”—’˜˜A AÔ&Õ&ˆAØ”—’˜˜B QÔ'Õ'ˆAØ×'Ñ'Ð+CÖCØ”5˜“;�. Õ" TÕ)¬U°4«[¨N¸A½CÀ½EÕ,BÕB÷ Ü—w’w˜q !¨!Ô,Ü˜4“[�N QÕ&¨Õ-´°t³°À!Å#ÀaÅ%Õ0HÕHõõó ð Ü˜4“[�N QÕ&¨Õ.´%¸³+°À1Å3ÀqÅ5Õ1IÕI÷ä—W’W˜Q ¨Ô+Ü˜4“[�N QÕ&¨Õ.´%¸³+°À1Å3ÀqÅ5Õ1IÕIõõó ð ×+Ñ+¨y×8ØÜ˜t›˜¨Õ*¨TÕ1´U¸4³[°NÀaÅcÈ!ÅeÕ4LÕL÷äŸš  A¨AÔ.Ü˜t›˜¨Õ*¨TÕ1´U¸4³[°NÀaÅcÈ!ÅeÕ4LÕLõõó ð
 Ü˜t›˜¨Õ*¨UÕ2´e¸D³k°^ÀqÅsÈ1ÅuÕ5MÕM÷äŸš  A¨AÔ.Ü˜t›˜¨Õ*¨UÕ2´e¸D³k°^ÀqÅsÈ1ÅuÕ5MÕMõõö ñ) ð4 �y‰y˜˜QŸW™W R�[Ó)Ð)r   c                ó$   € V P                  V4      # ©N©r‚   ©r   rW   s   &&r   Ú_matmatÚLaplacianNd._matmatÿ  s   € Ø�|‰|˜A‹Ðr   c                ó   € V # r…   © ©r   s   &r   Ú_adjointÚLaplacianNd._adjoint  ó   € Øˆr   c                ó   € V # r…   r‹   rŒ   s   &r   Ú
_transposeÚLaplacianNd._transpose  r�   r   )r	   r   r…   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r`   r   r2   r1   rF   rQ   rY   ro   rz   r‚   rˆ   r�   r‘   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r   Ú__classdict__s   @@r   r   r   
   sd   ù‡ € ñhðT4Ø%.ð4à—w‘w÷4ò" ô>ò"ò4*ô2ò6>$ò@'$òR*òBò÷ò r   c                   ó„   a a€ ] tR tRt oRt]P                  3V 3R lltRR ltR t	R t
R tR tR	 tR
 tR tRtVtV ;t# )ÚSakuraii	  aT  
Construct a Sakurai matrix in various formats and its eigenvalues.

Constructs the "Sakurai" matrix motivated by reference [1]_:
square real symmetric positive definite and 5-diagonal
with the main diagonal ``[5, 6, 6, ..., 6, 6, 5], the ``+1`` and ``-1``
diagonals filled with ``-4``, and the ``+2`` and ``-2`` diagonals
made of ``1``. Its eigenvalues are analytically known to be
``16. * np.power(np.cos(0.5 * k * np.pi / (n + 1)), 4)``.
The matrix gets ill-conditioned with its size growing.
It is useful for testing and benchmarking sparse eigenvalue solvers
especially those taking advantage of its banded 5-diagonal structure.
See the notes below for details.

Parameters
----------
n : int
    The size of the matrix.
dtype : dtype
    Numerical type of the array. Default is ``np.int8``.

Methods
-------
toarray()
    Construct a dense array from Laplacian data
tosparse()
    Construct a sparse array from Laplacian data
tobanded()
    The Sakurai matrix in the format for banded symmetric matrices,
    i.e., (3, n) ndarray with 3 upper diagonals
    placing the main diagonal at the bottom.
eigenvalues
    All eigenvalues of the Sakurai matrix ordered ascending.

Notes
-----
Reference [1]_ introduces a generalized eigenproblem for the matrix pair
`A` and `B` where `A` is the identity so we turn it into an eigenproblem
just for the matrix `B` that this function outputs in various formats
together with its eigenvalues.

.. versionadded:: 1.12.0

References
----------
.. [1] T. Sakurai, H. Tadano, Y. Inadomi, and U. Nagashima,
   "A moment-based method for large-scale generalized
   eigenvalue problems",
   Appl. Num. Anal. Comp. Math. Vol. 1 No. 2 (2004).

Examples
--------
>>> import numpy as np
>>> from scipy.sparse.linalg._special_sparse_arrays import Sakurai
>>> from scipy.linalg import eig_banded
>>> n = 6
>>> sak = Sakurai(n)

Since all matrix entries are small integers, ``'int8'`` is
the default dtype for storing matrix representations.

>>> sak.toarray()
array([[ 5, -4,  1,  0,  0,  0],
       [-4,  6, -4,  1,  0,  0],
       [ 1, -4,  6, -4,  1,  0],
       [ 0,  1, -4,  6, -4,  1],
       [ 0,  0,  1, -4,  6, -4],
       [ 0,  0,  0,  1, -4,  5]], dtype=int8)
>>> sak.tobanded()
array([[ 1,  1,  1,  1,  1,  1],
       [-4, -4, -4, -4, -4, -4],
       [ 5,  6,  6,  6,  6,  5]], dtype=int8)
>>> sak.tosparse()
<DIAgonal sparse array of dtype 'int8'
    with 24 stored elements (5 diagonals) and shape (6, 6)>
>>> np.array_equal(sak.dot(np.eye(n)), sak.tosparse().toarray())
True
>>> sak.eigenvalues()
array([0.03922866, 0.56703972, 2.41789479, 5.97822974,
       10.54287655, 14.45473055])
>>> sak.eigenvalues(2)
array([0.03922866, 0.56703972])

The banded form can be used in scipy functions for banded matrices, e.g.,

>>> e = eig_banded(sak.tobanded(), eigvals_only=True)
>>> np.allclose(sak.eigenvalues(), e, atol= n * n * n * np.finfo(float).eps)
True

c                óD   <€ Wn         W n        W3p\        SV `  W#4       R # r…   )r.   r   r   r   )r   r.   r   r   r   s   &&& €r   r   ÚSakurai.__init__d  s!   ø€ ØŒØŒ
Ø�ˆÜ‰Ñ˜Ö&r   c           
     ó–  € Vf   V P                   p\        P                  ! V P                   ^,           V,
          V P                   ^,           4      p\        P                  ! R\        P                  ! \        P
                  ! RV,          \        P                  ,          V P                   ^,           ,          4      ^4      ,          4      # )aE  Return the requested number of eigenvalues.

Parameters
----------
m : int, optional
    The positive number of smallest eigenvalues to return.
    If not provided, then all eigenvalues will be returned.

Returns
-------
eigenvalues : `np.float64` array
    The requested `m` smallest or all eigenvalues, in ascending order.
g      0@r9   )r.   r   r;   ÚflipÚpowerr=   r&   )r   r*   rN   s   && r   r1   ÚSakurai.eigenvaluesj  sw   € ð Š9Ø—‘ˆAÜ�IŠI�d—f‘f˜q•j !•m T§V¡V¨a¥ZÓ0ˆÜ�wŠw�sœRŸXšX¤b§f¢f¨S°1­W´r·u±u­_ÀÇÁÈÅ
Õ-KÓ&LÈaÓPÕPÓQÐQr   c                óÆ  € \         P                  ^^\         P                  ! V P                  ^,
          V P                  R7      ,          ^3,          pR\         P                  ! V P                  V P                  R7      ,          p\         P                  ! V P                  V P                  R7      p\         P
                  ! W2V.4      P                  V P                  4      # )z1
Construct the Sakurai matrix as a banded array.
r\   r   )r   Úr_r>   r.   r   Úarrayrg   )r   Úd0Úd1Úd2s   &   r   ÚtobandedÚSakurai.tobanded}  sŒ   € ô �U‰U�1�aœ"Ÿ'š' $§&¡&¨1¥*°D·J±JÔ?Õ?ÀÐBÕCˆØ”"—'’'˜$Ÿ&™&¨¯
©
Ô3Õ3ˆÜ�WŠW�T—V‘V 4§:¡:Ô.ˆÜ�xŠx˜ ˜Ó%×,Ñ,¨T¯Z©ZÓ8Ð8r   c                óÚ   € ^ RI Hp V P                  4       pV! V^ ,          V^,          V^,          V^,          V^ ,          .. ROV P                  V P                  3VP                  R7      # )z2
Construct the Sakurai matrix in a sparse format.
©Údiags_array©Úoffsetsr   r   )r^   r:   r   rJ   é   )Úscipy.sparser¯   r«   r.   r   )r   r¯   Úds   &  r   rz   ÚSakurai.tosparse†  s]   € õ 	-Ø�M‰M‹Oˆñ ˜A˜a�D ! A¥$¨¨!­¨a°­d°A°aµDÐ9ÒCTØ"&§&¡&¨$¯&©&Ð!1¸¿¹ôBð 	Br   c                ó>   € V P                  4       P                  4       # r…   ©rz   ro   rŒ   s   &r   ro   ÚSakurai.toarray‘  ó   € Ø�}‰}‹×&Ñ&Ó(Ð(r   c                ó²  € VP                  V P                  R4      p\        P                  ! VP                  V P                  4      p\        P
                  ! WR7      p^VR,          ,          ^VR,          ,          ,
          VR,          ,           VR&   ^VR,          ,          ^VR
,          ,          ,
          VR,          ,           VR&   ^V^R1R3,          ,          ^VRR	1R3,          VR,          ,           ,          ,
          \        P                  ! VRR1R3,          R4      ,           \        P                  ! VR,          R4      ,           V^R1R3&   V# )zÊ
Construct matrix-free callable banded-matrix-vector multiplication by
the Sakurai matrix without constructing or storing the matrix itself
using the knowledge of its entries and the 5-diagonal format.
r\   r]   Nr:   ©r   r]   rr   )r²   r]   ©r:   r]   r^   ©r^   r]   éýÿÿÿ)r¾   r]   ©:r²   NNr]   )rs   r_   ):é   NNr]   ))r   rJ   r_   )rf   r.   r   Úpromote_typesr   Ú
zeros_likeÚpad)r   rW   Úresult_dtypeÚsxs   &&  r   r‚   ÚSakurai._matvec”  s  € ð �I‰I�d—f‘f˜bÓ!ˆÜ×'Ò'¨¯©°·±Ó<ˆÜ�]Š]˜1Ô1ˆØ�q˜•w•;  Q t¥W¥Õ,¨q°­wÕ6ˆˆ4‰Ø˜˜%�•L 1 q¨¥x¥<Õ/°!°Eµ(Õ:ˆˆ5‰	Ø˜A˜a ˜e Q˜h�K�¨!¨q°°"°°a°­y¸1¸U½8Õ/CÕ*DÕDÜŸš˜q  "  a �yÐ*:Ó;õ<äŸš˜q �xÐ)9Ó:õ;ˆˆ1ˆbˆ5�!ˆ8‰ð ˆ	r   c                ó$   € V P                  V4      # )zÎ
Construct matrix-free callable matrix-matrix multiplication by
the Sakurai matrix without constructing or storing the matrix itself
by reusing the ``_matvec(x)`` that supports both 1D and 2D arrays ``x``.
r†   r‡   s   &&r   rˆ   ÚSakurai._matmat¤  ó   € ð �|‰|˜A‹Ðr   c                ó   € V # r…   r‹   rŒ   s   &r   r�   ÚSakurai._adjoint¬  r�   r   c                ó   € V # r…   r‹   rŒ   s   &r   r‘   ÚSakurai._transpose¯  r�   r   )r   r.   r…   )r“   r”   r•   r–   r—   r   r`   r   r1   r«   rz   ro   r‚   rˆ   r�   r‘   r˜   r™   rš   r›   s   @@r   rž   rž   	  sI   ù‡ € ñYðt !#§¡÷ 'ôRò&9ò	Bò)òò ò÷ò r   rž   c                   ó€   a a€ ] tR tRt oRt]P                  3V 3R lltR tR t	R t
R tR tR	 tR
 tR tRtVtV ;t# )ÚMikotaMi³  a'  
Construct a mass matrix in various formats of Mikota pair.

The mass matrix `M` is square real diagonal
positive definite with entries that are reciprocal to integers.

Parameters
----------
shape : tuple of int
    The shape of the matrix.
dtype : dtype
    Numerical type of the array. Default is ``np.float64``.

Methods
-------
toarray()
    Construct a dense array from Mikota data
tosparse()
    Construct a sparse array from Mikota data
tobanded()
    The format for banded symmetric matrices,
    i.e., (1, n) ndarray with the main diagonal.
c                ó>   <€ Wn         W n        \        SV `  W!4       R # r…   )r   r   r   r   )r   r   r   r   s   &&&€r   r   ÚMikotaM.__init__Ë  s   ø€ ØŒ
ØŒ
Ü‰Ñ˜Ö&r   c                ó    € R \         P                  ! ^V P                  ^ ,          ^,           4      ,          P                  V P                  4      # )r8   )r   r;   r   rg   r   rŒ   s   &r   Ú_diagÚMikotaM._diagÐ  s6   € ð ”R—Y’Y˜q $§*¡*¨Q¥-°!Õ"3Ó4Õ4×<Ñ<¸T¿Z¹ZÓHÐHr   c                ó"   € V P                  4       # r…   )rÓ   rŒ   s   &r   r«   ÚMikotaM.tobandedÕ  s   € Ø�z‰z‹|Ðr   c                ón   € ^ RI Hp V! V P                  4       .^ .V P                  V P                  R7      # )r   r®   r°   )r³   r¯   rÓ   r   r   ©r   r¯   s   & r   rz   ÚMikotaM.tosparseØ  s-   € Ý,Ù˜DŸJ™J›L˜>°A°3Ø!%§¡°4·:±:ô?ð 	?r   c                ó|   € \         P                  ! V P                  4       4      P                  V P                  4      # r…   )r   ÚdiagrÓ   rg   r   rŒ   s   &r   ro   ÚMikotaM.toarrayÝ  s&   € Ü�wŠw�t—z‘z“|Ó$×+Ñ+¨D¯J©JÓ7Ð7r   c                ó¤   € VP                  V P                  ^ ,          R4      pV P                  4       R\        P                  3,          V,          # )zÌ
Construct matrix-free callable banded-matrix-vector multiplication by
the Mikota mass matrix without constructing or storing the matrix itself
using the knowledge of its entries and the diagonal format.
r]   r:   )rf   r   rÓ   r   Únewaxisr‡   s   &&r   r‚   ÚMikotaM._matvecà  s:   € ð �I‰I�d—j‘j •m RÓ(ˆØ�z‰z‹|˜AœrŸz™z˜MÕ*¨QÕ.Ð.r   c                ó$   € V P                  V4      # )zÒ
Construct matrix-free callable matrix-matrix multiplication by
the Mikota mass matrix without constructing or storing the matrix itself
by reusing the ``_matvec(x)`` that supports both 1D and 2D arrays ``x``.
r†   r‡   s   &&r   rˆ   ÚMikotaM._matmaté  rÉ   r   c                ó   € V # r…   r‹   rŒ   s   &r   r�   ÚMikotaM._adjointñ  r�   r   c                ó   € V # r…   r‹   rŒ   s   &r   r‘   ÚMikotaM._transposeô  r�   r   r   )r“   r”   r•   r–   r—   r   rB   r   rÓ   r«   rz   ro   r‚   rˆ   r�   r‘   r˜   r™   rš   r›   s   @@r   rÏ   rÏ   ³  sF   ù‡ € ñð. %'§J¡J÷ 'ò
Iò
ò?ò
8ò/òò÷ò r   rÏ   c                   óz   a a€ ] tR tRt oRt]P                  3V 3R lltR tR t	R t
R tR tR	 tR
 tRtVtV ;t# )ÚMikotaKiø  aQ  
Construct a stiffness matrix in various formats of Mikota pair.

The stiffness matrix `K` is square real tri-diagonal symmetric
positive definite with integer entries.

Parameters
----------
shape : tuple of int
    The shape of the matrix.
dtype : dtype
    Numerical type of the array. Default is ``np.int32``.

Methods
-------
toarray()
    Construct a dense array from Mikota data
tosparse()
    Construct a sparse array from Mikota data
tobanded()
    The format for banded symmetric matrices,
    i.e., (2, n) ndarray with 2 upper diagonals
    placing the main diagonal at the bottom.
c                ó   <€ Wn         W n        \        SV `  W!4       V^ ,          p\        P
                  ! ^V,          ^,
          ^ RV P                  R7      V n        \        P
                  ! V^,
          ^ RV P                  R7      ) V n        R# )r   r\   Nr^   r:   )r   r   r   r   r   r;   Ú_diag0Ú_diag1)r   r   r   r.   r   s   &&& €r   r   ÚMikotaK.__init__  sh   ø€ ØŒ
ØŒ
Ü‰Ñ˜Ô&ð �!�HˆÜ—i’i  A¥¨¥	¨1¨b¸¿
¹
ÔCˆŒÜŸ	š	 ! a¥%¨¨B°d·j±jÔAÐAˆŽr   c                ó†   € \         P                  ! \         P                  ! V P                  RR4      V P                  .4      # )rJ   Úconstantrs   )r   r§   rÃ   rê   ré   rŒ   s   &r   r«   ÚMikotaK.tobanded  s+   € Ü�xŠxœŸš §¡¨V°ZÓ@À$Ç+Á+ÐNÓOÐOr   c                ó”   € ^ RI Hp V! V P                  V P                  V P                  .. ROV P                  V P
                  R7      # )r   r®   r°   rt   )r³   r¯   rê   ré   r   r   rØ   s   & r   rz   ÚMikotaK.tosparse  s6   € Ý,Ù˜DŸK™K¨¯©°d·k±kÐBÊJØ!%§¡°4·:±:ô?ð 	?r   c                ó>   € V P                  4       P                  4       # r…   r·   rŒ   s   &r   ro   ÚMikotaK.toarray#  r¹   r   c                ó¤  € VP                  V P                  ^ ,          R4      p\        P                  ! VP                  V P                  4      p\        P
                  ! WR7      pV P                  pV P                  pV^ ,          VR,          ,          V^ ,          VR,          ,          ,           VR&   VR,          VR,          ,          VR,          VR	,          ,          ,           VR	&   VRR1R3,          VRR1R3,          ,          V^R1R3,          V^R1R3,          ,          ,           VR
,          VR,          ,          ,           V^R1R3&   V# )zÓ
Construct matrix-free callable banded-matrix-vector multiplication by
the Mikota stiffness matrix without constructing or storing the matrix
itself using the knowledge of its entries and the 3-diagonal format.
r\   r]   Nr:   r»   rr   r^   r½   r¼   )rI   Nr¿   )rf   r   r   rÁ   r   rÂ   rê   ré   )r   rW   rÄ   Úkxr©   r¨   s   &&    r   r‚   ÚMikotaK._matvec&  s  € ð �I‰I�d—j‘j •m RÓ(ˆÜ×'Ò'¨¯©°·±Ó<ˆÜ�]Š]˜1Ô1ˆØ�[‰[ˆØ�[‰[ˆØ�a•5˜1˜T�7•? R¨¥U¨Q¨t­W¥_Õ4ˆˆ4‰Ø�r•F˜Q˜u�XÕ%¨¨2­°°5µÕ(9Õ9ˆˆ5‰	Ø˜3˜B˜3 ˜9�¨¨$¨B¨$°¨'­
Õ2Ø˜Q ˜U D˜[�/¨A¨a°¨e°Q¨h­KÕ7õ8à˜X�,¨¨5­Õ1õ2ˆˆ1ˆbˆ5�!ˆ8‰ð ˆ	r   c                ó$   € V P                  V4      # )zÕ
Construct matrix-free callable matrix-matrix multiplication by
the Stiffness mass matrix without constructing or storing the matrix itself
by reusing the ``_matvec(x)`` that supports both 1D and 2D arrays ``x``.
r†   r‡   s   &&r   rˆ   ÚMikotaK._matmat8  rÉ   r   c                ó   € V # r…   r‹   rŒ   s   &r   r�   ÚMikotaK._adjoint@  r�   r   c                ó   € V # r…   r‹   rŒ   s   &r   r‘   ÚMikotaK._transposeC  r�   r   )ré   rê   r   r   )r“   r”   r•   r–   r—   r   Úint32r   r«   rz   ro   r‚   rˆ   r�   r‘   r˜   r™   rš   r›   s   @@r   rç   rç   ø  sB   ù‡ € ñð0 %'§H¡H÷ BòPò?ò
)òò$ò÷ò r   rç   c                   óN   a € ] tR tRt o Rt]P                  3R ltRR ltRt	V t
R# )Ú
MikotaPairiG  ai  
Construct the Mikota pair of matrices in various formats and
eigenvalues of the generalized eigenproblem with them.

The Mikota pair of matrices [1, 2]_ models a vibration problem
of a linear mass-spring system with the ends attached where
the stiffness of the springs and the masses increase along
the system length such that vibration frequencies are subsequent
integers 1, 2, ..., `n` where `n` is the number of the masses. Thus,
eigenvalues of the generalized eigenvalue problem for
the matrix pair `K` and `M` where `K` is the system stiffness matrix
and `M` is the system mass matrix are the squares of the integers,
i.e., 1, 4, 9, ..., ``n * n``.

The stiffness matrix `K` is square real tri-diagonal symmetric
positive definite. The mass matrix `M` is diagonal with diagonal
entries 1, 1/2, 1/3, ...., ``1/n``. Both matrices get
ill-conditioned with `n` growing.

Parameters
----------
n : int
    The size of the matrices of the Mikota pair.
dtype : dtype
    Numerical type of the array. Default is ``np.float64``.

Attributes
----------
eigenvalues : 1D ndarray, ``np.uint64``
    All eigenvalues of the Mikota pair ordered ascending.

Methods
-------
MikotaK()
    A `LinearOperator` custom object for the stiffness matrix.
MikotaM()
    A `LinearOperator` custom object for the mass matrix.

.. versionadded:: 1.12.0

References
----------
.. [1] J. Mikota, "Frequency tuning of chain structure multibody oscillators
   to place the natural frequencies at omega1 and N-1 integer multiples
   omega2,..., omegaN", Z. Angew. Math. Mech. 81 (2001), S2, S201-S202.
   Appl. Num. Anal. Comp. Math. Vol. 1 No. 2 (2004).
.. [2] Peter C. Muller and Metin Gurgoze,
   "Natural frequencies of a multi-degree-of-freedom vibration system",
   Proc. Appl. Math. Mech. 6, 319-320 (2006).
   :doi:`10.1002/pamm.200610141`.

Examples
--------
>>> import numpy as np
>>> from scipy.sparse.linalg._special_sparse_arrays import MikotaPair
>>> n = 6
>>> mik = MikotaPair(n)
>>> mik_k = mik.k
>>> mik_m = mik.m
>>> mik_k.toarray()
array([[11., -5.,  0.,  0.,  0.,  0.],
       [-5.,  9., -4.,  0.,  0.,  0.],
       [ 0., -4.,  7., -3.,  0.,  0.],
       [ 0.,  0., -3.,  5., -2.,  0.],
       [ 0.,  0.,  0., -2.,  3., -1.],
       [ 0.,  0.,  0.,  0., -1.,  1.]])
>>> mik_k.tobanded()
array([[ 0., -5., -4., -3., -2., -1.],
       [11.,  9.,  7.,  5.,  3.,  1.]])
>>> mik_m.tobanded()
array([1.        , 0.5       , 0.33333333, 0.25      , 0.2       ,
    0.16666667])
>>> mik_k.tosparse()
<DIAgonal sparse array of dtype 'float64'
    with 16 stored elements (3 diagonals) and shape (6, 6)>
>>> mik_m.tosparse()
<DIAgonal sparse array of dtype 'float64'
    with 6 stored elements (1 diagonals) and shape (6, 6)>
>>> np.array_equal(mik_k(np.eye(n)), mik_k.toarray())
True
>>> np.array_equal(mik_m(np.eye(n)), mik_m.toarray())
True
>>> mik.eigenvalues()
array([ 1,  4,  9, 16, 25, 36])
>>> mik.eigenvalues(2)
array([ 1,  4])

c                óÂ   € Wn         W n        W3V n        \        V P                  V P                  4      V n        \        V P                  V P                  4      V n        R # r…   )r.   r   r   rÏ   r*   rç   rN   )r   r.   r   s   &&&r   r   ÚMikotaPair.__init__   sA   € ØŒØŒ
Ø�VˆŒ
Ü˜Ÿ™ T§Z¡ZÓ0ˆŒÜ˜Ÿ™ T§Z¡ZÓ0ˆŽr   Nc                óŽ   € Vf   V P                   p\        P                  ! ^V^,           \        P                  R7      pW",          # )aD  Return the requested number of eigenvalues.

Parameters
----------
m : int, optional
    The positive number of smallest eigenvalues to return.
    If not provided, then all eigenvalues will be returned.

Returns
-------
eigenvalues : `np.uint64` array
    The requested `m` smallest or all eigenvalues, in ascending order.
r\   )r.   r   r;   Úuint64)r   r*   Úarange_plus1s   && r   r1   ÚMikotaPair.eigenvalues§  s5   € ð Š9Ø—‘ˆAÜ—y’y  A¨¥E´·±Ô;ˆØÕ*Ð*r   )r   rN   r*   r.   r   r…   )r“   r”   r•   r–   r—   r   rB   r   r1   r˜   r™   )rœ   s   @r   rþ   rþ   G  s$   ø‡ € ñWðp !#§
¡
ô 1÷+ò +r   rþ   )Únumpyr   Úscipy.sparse.linalgr   r³   r   r   r   Ú__all__r   rž   rÏ   rç   rþ   r‹   r   r   Ú<module>r     s`   ðÛ Ý .ß 3Ñ 3àˆ/€ô
|�.ô |ô~gˆnô gôTBˆnô BôJLˆnô L÷^q+ó q+r   