§
    µ³ÙgZH  ã                   ó¨  — d dl Z d dlZd dlZddlmZ ddlmZmZm	Z	m
Z
 ddlmZmZmZmZ g d¢Z G d„ d¦  «        Z ee	d	d ¬
¦  «        Z	e	j        d„ ¦   «         Ze	j        d„ ¦   «         Z eedd ¬
¦  «        Zej        d„ ¦   «         Zej        d„ ¦   «         Zej        d„ ¦   «         Zej        d„ ¦   «         Z eedddd ¬¦  «        Zej        d„ ¦   «         Zej        d„ ¦   «         Zej        d„ ¦   «         Z eedddd ¬¦  «        Zej        d„ ¦   «         Zej        d„ ¦   «         Zej        d„ ¦   «         Zej        d„ ¦   «         Zej        d„ ¦   «         Z eedd ¬
¦  «        Zej        d „ ¦   «         Zej        d!„ ¦   «         Z eed"d ¬
¦  «        Zej        d#„ ¦   «         Zej        d$„ ¦   «         Zej        d%„ ¦   «         Zej        d&„ ¦   «         Z ee
d'd(d ¬)¦  «        Z
e
j        d*„ ¦   «         Ze
j        d+„ ¦   «         Z eed,d(d ¬)¦  «        Zej        d-„ ¦   «         Zej        d.„ ¦   «         Zej        d/„ ¦   «         Zej        d0„ ¦   «         ZdS )1é    Né   ©Ú_nonneg_int_or_fail)Ú
legendre_pÚassoc_legendre_pÚsph_legendre_pÚ
sph_harm_y)Úlegendre_p_allÚassoc_legendre_p_allÚsph_legendre_p_allÚsph_harm_y_all)r   r   r   r
   r	   r   r   r   c                   ó\   — e Zd Zdddœd„Zed„ ¦   «         Zd„ Zd„ Zd„ Zd	„ Z	d
„ Z
d„ Zd„ ZdS )Ú
MultiUFuncNF)Úforce_complex_outputc                óª  — t          |t          j        ¦  «        s÷t          |t          j        j        ¦  «        r|                     ¦   «         }n1t          |t          j        j        ¦  «        r|}nt          d¦  «        ‚t          ¦   «         }|D ]_}t          |t          j        ¦  «        st          d|› �¦  «        ‚| 
                    t          d„ |j        D ¦   «         ¦  «        ¦  «         Œ`t          |¦  «        dk    rt          d¦  «        ‚|| _        || _        || _        || _        d | _        d | _        d | _        d„ | _        d„ | _        d S )Nz7ufunc_or_ufuncs should be a ufunc or a ufunc collectionz2All ufuncs must have type `numpy.ufunc`. Received c              3   óL   K  — | ]}|                      d ¦  «        d         V — Œ dS )z->r   N)Úsplit)Ú.0Úxs     úP/granary/edev/quantum/lib/python3.11/site-packages/scipy/special/_multiufuncs.pyú	<genexpr>z&MultiUFunc.__init__.<locals>.<genexpr>+   s1   è è € Ð.UÐ.UÀA¨q¯wªw°t©}¬}¸QÔ/?Ð.UÐ.UÐ.UÐ.UÐ.UÐ.Uó    r   z*All ufuncs must take the same input types.c                  ó   — dS )N© r   ©ÚargsÚkwargss     r   ú<lambda>z%MultiUFunc.__init__.<locals>.<lambda>6   s   € ¸2€ r   c                  ó   — i S ©Nr   r   s     r   r   z%MultiUFunc.__init__.<locals>.<lambda>7   s   € ¸R€ r   )Ú
isinstanceÚnpÚufuncÚcollectionsÚabcÚMappingÚvaluesÚIterableÚ
ValueErrorÚsetÚaddÚ	frozensetÚtypesÚlenÚ_ufunc_or_ufuncsÚ_MultiUFunc__docÚ!_MultiUFunc__force_complex_outputÚ_default_kwargsÚ_resolve_out_shapesÚ_finalize_outÚ_keyÚ_ufunc_default_argsÚ_ufunc_default_kwargs)ÚselfÚufunc_or_ufuncsÚdocr   Údefault_kwargsÚufuncs_iterÚseen_input_typesr#   s           r   Ú__init__zMultiUFunc.__init__   sw  € å˜/­2¬8Ñ4Ô4ð 	OÝ˜/­;¬?Ô+BÑCÔCð 6Ø-×4Ò4Ñ6Ô6��Ý˜O­[¬_Ô-EÑFÔFð 6Ø-��å ð "5ñ 6ô 6ð 6õ
  #™uœuÐØ$ð Wð W�Ý! %­¬Ñ2Ô2ð EÝ$ð &DØ2Að&Dð &Dñ Eô Eð Eà ×$Ò$¥YÐ.UÐ.UÈÌÐ.UÑ.UÔ.UÑ%UÔ%UÑVÔVÐVÐVÝÐ#Ñ$Ô$ qÒ(Ð(Ý Ð!MÑNÔNÐNà /ˆÔØˆŒ
Ø&:ˆÔ#Ø-ˆÔØ#'ˆÔ Ø!ˆÔØˆŒ	Ø#=Ð#=ˆÔ Ø%?Ð%?ˆÔ"Ð"Ð"r   c                 ó   — | j         S r    )r0   )r8   s    r   Ú__doc__zMultiUFunc.__doc__9   s
   € àŒzÐr   c                 ó   — || _         dS )z3Set `key` method by decorating a function.
        N)r5   ©r8   Úfuncs     r   Ú_override_keyzMultiUFunc._override_key=   s   € ð ˆŒ	ˆ	ˆ	r   c                 ó   — || _         d S r    )r6   rB   s     r   Ú_override_ufunc_default_argsz'MultiUFunc._override_ufunc_default_argsB   s   € Ø#'ˆÔ Ð Ð r   c                 ó   — || _         d S r    )r7   rB   s     r   Ú_override_ufunc_default_kwargsz)MultiUFunc._override_ufunc_default_kwargsE   s   € Ø%)ˆÔ"Ð"Ð"r   c                 ó>   — |j         €d|_         d|_        || _        dS )z9Set `resolve_out_shapes` method by decorating a function.Nz2Resolve to output shapes based on relevant inputs.Úresolve_out_shapes)r@   Ú__name__r3   rB   s     r   Ú_override_resolve_out_shapesz'MultiUFunc._override_resolve_out_shapesH   s)   € àŒ<ÐàHð ŒLà,ˆŒØ#'ˆÔ Ð Ð r   c                 ó   — || _         d S r    )r4   rB   s     r   Ú_override_finalize_outz!MultiUFunc._override_finalize_outP   s   € Ø!ˆÔÐÐr   c                 ó‚   — t          | j        t          j        ¦  «        r| j        S  | j        di |¤Ž}| j        |         S )z.Resolve to a ufunc based on keyword arguments.r   )r!   r/   r"   r#   r5   )r8   r   Ú	ufunc_keys      r   Ú_resolve_ufunczMultiUFunc._resolve_ufuncS   sI   € õ �dÔ+­R¬XÑ6Ô6ð 	)ØÔ(Ð(à�D”IÐ'Ð' Ð'Ð'ˆ	ØÔ$ YÔ/Ð/r   c                 óR  — | j         |z  }| | j        d	i |¤Žz  } | j        d	i |¤Ž}d„ ||j         d …         D ¦   «         } | j        d	i |¤Ž}| j        ��,t          d„ |D ¦   «         ¦  «        } | j        g |d |j         …         ¢|¢|j        ‘R i |¤Ž}t          d„ |D ¦   «         ¦  «        }t          |d¦  «        r3||j        dz  z   }	| 	                    |	¦  «        }	|	|j         d …         }
nDt          j        |Ž }t          j        |t          j        ¦  «        st          j        }|j        |fz  }
| j        rt          d„ |
D ¦   «         ¦  «        }
t          d„ t!          ||
¦  «        D ¦   «         ¦  «        }||d<    ||i |¤Ž}| j        �|                      |¦  «        }|S )
Nc                 ó6   — g | ]}t          j        |¦  «        ‘ŒS r   )r"   Úasarray)r   Úargs     r   ú
<listcomp>z'MultiUFunc.__call__.<locals>.<listcomp>d   s    € ÐCÐCÐC¨#•b”j ‘o”oÐCÐCÐCr   c              3   ó>   K  — | ]}t          j        |¦  «        V — Œd S r    )r"   Úshape©r   Ú	ufunc_args     r   r   z&MultiUFunc.__call__.<locals>.<genexpr>i   s,   è è € Ð$UÐ$U¸Y¥R¤X¨iÑ%8Ô%8Ð$UÐ$UÐ$UÐ$UÐ$UÐ$Ur   c              3   ó†   K  — | ]<}t          |d ¦  «        r|j        n t          j        t          |¦  «        ¦  «        V — Œ=dS )ÚdtypeN)Úhasattrr\   r"   ÚtyperY   s     r   r   z&MultiUFunc.__call__.<locals>.<genexpr>n   sh   è è € ð %Bð %Bà)2õ 9@À	È7Ñ8SÔ8Sð &D Y¤_ _Ý*,¬(µ4¸	±?´?Ñ*CÔ*Cð%Bð %Bð %Bð %Bð %Bð %Br   Úresolve_dtypesr    c              3   ó@   K  — | ]}t          j        d |¦  «        V — ŒdS )y              ð?N)r"   Úresult_type)r   Úufunc_out_dtypes     r   r   z&MultiUFunc.__call__.<locals>.<genexpr>~   sJ   è è € ð )Rð )RØ-<õ *,¬¸¸OÑ)LÔ)Lð )Rð )Rð )Rð )Rð )Rð )Rr   c              3   óH   K  — | ]\  }}t          j        ||¬ ¦  «        V — ŒdS ))r\   N)r"   Úempty)r   Úufunc_out_shaperb   s      r   r   z&MultiUFunc.__call__.<locals>.<genexpr>�   sQ   è è € ð Dð DÙ<˜O¨_õ œ ¸ÐHÑHÔHð Dð Dð Dð Dð Dð Dr   Úoutr   )r2   r6   rQ   Úninr7   r3   ÚtupleÚnoutr]   r_   r"   ra   Ú
issubdtypeÚinexactÚfloat64r1   Úzipr4   )r8   r   r   r#   Ú
ufunc_argsÚufunc_kwargsÚufunc_arg_shapesÚufunc_out_shapesÚufunc_arg_dtypesÚufunc_dtypesÚufunc_out_dtypesrb   rf   s                r   Ú__call__zMultiUFunc.__call__\   sz  € ØÔ%¨Ñ.ˆàÐ(�Ô(Ð2Ð2¨6Ð2Ð2Ñ2ˆà#�Ô#Ð-Ð- fÐ-Ð-ˆð DÐC°°u´y°j°k°kÔ1BÐCÑCÔCˆ
à1�tÔ1Ð;Ð;°FÐ;Ð;ˆàÔ$Ñ0Ý$Ð$UÐ$UÈ*Ð$UÑ$UÔ$UÑUÔUÐØ7˜tÔ7ð  B¸¸kÀÄ	¸z¸kÔ9Jð  BØ9Ið BØKPÌ:ð Bð  Bð  Bà:@ð Bð  BÐõ  %ð %Bð %Bà6@ð%Bñ %Bô %Bñ  Bô  BÐõ �uÐ.Ñ/Ô/ð 	CØ/°%´*¸wÑ2FÑF�Ø$×3Ò3°LÑAÔA�Ø#/°´°°°Ô#=Ð Ð å"$¤.Ð2BÐ"C�Ýœ oµr´zÑBÔBð 1Ý&(¤j�Oà#(¤:°Ð0BÑ#BÐ àÔ*ð RÝ#(ð )Rð )RØ@Pð)Rñ )Rô )Rñ $Rô $RÐ õ ð Dð DåÐ/Ð1AÑBÔBðDñ Dô Dñ Dô DˆCð #&ˆL˜Ñàˆe�ZÐ0 <Ð0Ð0ˆØÔÐ*Ø×$Ò$ SÑ)Ô)ˆCàˆ
r   r    )rK   Ú
__module__Ú__qualname__r>   Úpropertyr@   rD   rF   rH   rL   rN   rQ   ru   r   r   r   r   r      sÀ   € € € € € ð@Ø&+ð@ð @ð @ð @ð @ð@ ðð ñ „Xððð ð ð
(ð (ð (ð*ð *ð *ð(ð (ð (ð"ð "ð "ð0ð 0ð 0ð/ð /ð /ð /ð /r   r   a¢  sph_legendre_p(n, m, theta, *, diff_n=0)

    Spherical Legendre polynomial of the first kind.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the spherical Legendre polynomial. Must have ``n >= 0``.
    m : ArrayLike[int]
        Order of the spherical Legendre polynomial.
    theta : ArrayLike[float]
        Input value.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    p : ndarray or tuple[ndarray]
        Spherical Legendre polynomial with ``diff_n`` derivatives.

    Notes
    -----
    The spherical counterpart of an (unnormalized) associated Legendre polynomial has
    the additional factor

    .. math::

        \sqrt{\frac{(2 n + 1) (n - m)!}{4 \pi (n + m)!}}

    It is the same as the spherical harmonic :math:`Y_{n}^{m}(\theta, \phi)`
    with :math:`\phi = 0`.
    ©Údiff_nc                 ón   — t          | dd¬¦  «        } d| cxk    rdk    sn t          d| › d�¦  «        ‚| S ©Nrz   F©Ústrictr   é   úGdiff_n is currently only implemented for orders 0, 1, and 2, received: ú.©r   r)   ry   s    r   Ú_rƒ   ´   óe   € å  ¨¸%Ð@Ñ@Ô@€FØ�ÐÐÒÐ˜!ÒÐÐÐÝð$Ø ð$ð $ð $ñ
ô 
ð 	
ð €Mr   c                 ó.   — t          j        | dd¦  «        S ©Néÿÿÿÿr   ©r"   Úmoveaxis©rf   s    r   rƒ   rƒ   ¿   ó   € åŒ;�s˜B Ñ"Ô"Ð"r   a|  sph_legendre_p_all(n, m, theta, *, diff_n=0)

    All spherical Legendre polynomials of the first kind up to the
    specified degree ``n`` and order ``m``.

    Output shape is ``(n + 1, 2 * m + 1, ...)``. The entry at ``(j, i)``
    corresponds to degree ``j`` and order ``i`` for all  ``0 <= j <= n``
    and ``-m <= i <= m``.

    See Also
    --------
    sph_legendre_p
    c                 ón   — t          | dd¬¦  «        } d| cxk    rdk    sn t          d| › d�¦  «        ‚| S r|   r‚   ry   s    r   rƒ   rƒ   Ö   r„   r   c                 ó   — ddgdgz   iS ©NÚaxesr   )r   r   r‡   r   ry   s    r   rƒ   rƒ   á   s   € à�R�D˜J˜<Ñ'Ð(Ð(r   c                 óª   — t          | t          j        ¦  «        r| dk     rt          d¦  «        ‚| dz   dt	          |¦  «        z  dz   f|z   |dz   fz   fS )Nr   ú!n must be a non-negative integer.r   r   )r!   ÚnumbersÚIntegralr)   Úabs)ÚnÚmÚtheta_shaperi   rz   s        r   rƒ   rƒ   æ   s^   € å�a�Ô)Ñ*Ô*ð >¨q°1ªu¨uÝÐ<Ñ=Ô=Ð=à�‰U�A�˜A™œ‘J ‘NÐ# kÑ1°V¸a±Z°MÑAÐCÐCr   c                 ó.   — t          j        | dd¦  «        S r†   rˆ   rŠ   s    r   rƒ   rƒ   î   r‹   r   a—  assoc_legendre_p(n, m, z, *, branch_cut=2, norm=False, diff_n=0)

    Associated Legendre polynomial of the first kind.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the associated Legendre polynomial. Must have ``n >= 0``.
    m : ArrayLike[int]
        order of the associated Legendre polynomial.
    z : ArrayLike[float | complex]
        Input value.
    branch_cut : Optional[ArrayLike[int]]
        Selects branch cut. Must be 2 (default) or 3.
        2: cut on the real axis ``|z| > 1``
        3: cut on the real axis ``-1 < z < 1``
    norm : Optional[bool]
        If ``True``, compute the normalized associated Legendre polynomial.
        Default is ``False``.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    p : ndarray or tuple[ndarray]
        Associated Legendre polynomial with ``diff_n`` derivatives.

    Notes
    -----
    The normalized counterpart of an (unnormalized) associated Legendre
    polynomial has the additional factor

    .. math::

        \sqrt{\frac{(2 n + 1) (n - m)!}{2 (n + m)!}}
    r   F©Ú
branch_cutÚnormrz   c                 ór   — t          |dd¬¦  «        }d|cxk    rdk    sn t          d|› d�¦  «        ‚||fS r|   r‚   r™   s      r   rƒ   rƒ     sj   € å  ¨¸%Ð@Ñ@Ô@€FØ�ÐÐÒÐ˜!ÒÐÐÐÝð$Ø ð$ð $ð $ñ
ô 
ð 	
ð �ˆ<Ðr   c                 ó   — | fS r    r   r™   s      r   rƒ   rƒ   (  ó
   € àˆ;Ðr   c                 ó.   — t          j        | dd¦  «        S r†   rˆ   rŠ   s    r   rƒ   rƒ   -  r‹   r   a—  assoc_legendre_p_all(n, m, z, *, branch_cut=2, norm=False, diff_n=0)

    All associated Legendre polynomials of the first kind up to the
    specified degree ``n`` and order ``m``.

    Output shape is ``(n + 1, 2 * m + 1, ...)``. The entry at ``(j, i)``
    corresponds to degree ``j`` and order ``i`` for all  ``0 <= j <= n``
    and ``-m <= i <= m``.

    See Also
    --------
    assoc_legendre_p
    c                 ó´   — t          |t          j        ¦  «        r|dk    st          d|› d�¦  «        ‚d|cxk    rdk    sn t          d|› d�¦  «        ‚||fS ©Nr   z1diff_n must be a non-negative integer, received: r�   r   r€   )r!   r’   r“   r)   r™   s      r   rƒ   rƒ   D  s–   € å˜¥Ô 0Ñ1Ô1ð 
Ø˜!’�ÝØIÀÐIÐIÐIñ
ô 
ð 	
ð �ÐÐÒÐ˜!ÒÐÐÐÝð$Ø ð$ð $ð $ñ
ô 
ð 	
ð �ˆ<Ðr   c                 ó   — | fS r    r   r™   s      r   rƒ   rƒ   S  rž   r   c                 ó   — dddgdgz   iS rŽ   r   r™   s      r   rƒ   rƒ   X  s   € à�R˜�H 
˜|Ñ+Ð,Ð,r   c                 ó>  — |d         }t          | t          j        ¦  «        r| dk     rt          d¦  «        ‚t          |t          j        ¦  «        r|dk     rt          d¦  «        ‚| dz   dt	          |¦  «        z  dz   ft          j        ||¦  «        z   |dz   fz   fS )Nrz   r   r‘   z!m must be a non-negative integer.r   r   ©r!   r’   r“   r)   r”   r"   Úbroadcast_shapes)r•   r–   Úz_shapeÚbranch_cut_shaperi   r   rz   s          r   rƒ   rƒ   ]  s¯   € à�HÔ€Få�a�Ô)Ñ*Ô*ð >¨q°1ªu¨uÝÐ<Ñ=Ô=Ð=Ý�a�Ô)Ñ*Ô*ð >¨q°1ªu¨uÝÐ<Ñ=Ô=Ð=à�‰U�A�˜A™œ‘J ‘NÐ#Ý
Ô˜GÐ%5Ñ6Ô6ñ7Ø:@À1¹*¸ñGð Ið Ir   c                 ó.   — t          j        | dd¦  «        S r†   rˆ   rŠ   s    r   rƒ   rƒ   j  r‹   r   a  legendre_p(n, z, *, diff_n=0)

    Legendre polynomial of the first kind.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the Legendre polynomial. Must have ``n >= 0``.
    z : ArrayLike[float]
        Input value.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    p : ndarray or tuple[ndarray]
        Legendre polynomial with ``diff_n`` derivatives.

    See Also
    --------
    legendre

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
    c                 ó°   — t          | t          j        ¦  «        r| dk     rt          d| › d�¦  «        ‚d| cxk    rdk    sn t	          d| › d�¦  «        ‚| S r¡   )r!   r’   r“   r)   ÚNotImplementedErrorry   s    r   rƒ   rƒ   ‘  s�   € å�v�wÔ/Ñ0Ô0ð 
°f¸q²j°jÝØIÀÐIÐIÐIñ
ô 
ð 	
ð �ÐÐÒÐ˜!ÒÐÐÐÝ!ð$Ø ð$ð $ð $ñ
ô 
ð 	
ð €Mr   c                 ó.   — t          j        | dd¦  «        S r†   rˆ   rŠ   s    r   rƒ   rƒ   Ÿ  r‹   r   a  legendre_p_all(n, z, *, diff_n=0)

    All Legendre polynomials of the first kind up to the
    specified degree ``n``.

    Output shape is ``(n + 1, ...)``. The entry at ``j``
    corresponds to degree ``j`` for all  ``0 <= j <= n``.

    See Also
    --------
    legendre_p
    c                 ón   — t          | dd¬¦  «        } d| cxk    rdk    sn t          d| › d�¦  «        ‚| S r|   r‚   ry   s    r   rƒ   rƒ   µ  r„   r   c                 ó   — dddgiS )Nr�   r   )r   r‡   r   ry   s    r   rƒ   rƒ   À  s   € à�R˜�MÐ"Ð"r   c                 óN   — t          | dd¬¦  «        } || dz   f|z   |dz   fz   fz  S )Nr•   Fr}   r   r   )r•   r§   ri   rz   s       r   rƒ   rƒ   Å  s:   € å˜A˜s¨5Ð1Ñ1Ô1€Aà�A˜‘E�8˜gÑ%¨°!©¨Ñ5Ð7Ñ7Ð7r   c                 ó.   — t          j        | dd¦  «        S r†   rˆ   rŠ   s    r   rƒ   rƒ   Ì  r‹   r   aÌ  sph_harm_y(n, m, theta, phi, *, diff_n=0)

    Spherical harmonics. They are defined as

    .. math::

        Y_n^m(\theta,\phi) = \sqrt{\frac{2 n + 1}{4 \pi} \frac{(n - m)!}{(n + m)!}}
            P_n^m(\cos(\theta)) e^{i m \phi}

    where :math:`P_n^m` are the (unnormalized) associated Legendre polynomials.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the harmonic. Must have ``n >= 0``. This is
        often denoted by ``l`` (lower case L) in descriptions of
        spherical harmonics.
    m : ArrayLike[int]
        Order of the harmonic.
    theta : ArrayLike[float]
        Polar (colatitudinal) coordinate; must be in ``[0, pi]``.
    phi : ArrayLike[float]
        Azimuthal (longitudinal) coordinate; must be in ``[0, 2*pi]``.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    y : ndarray[complex] or tuple[ndarray[complex]]
       Spherical harmonics with ``diff_n`` derivatives.

    Notes
    -----
    There are different conventions for the meanings of the input
    arguments ``theta`` and ``phi``. In SciPy ``theta`` is the
    polar angle and ``phi`` is the azimuthal angle. It is common to
    see the opposite convention, that is, ``theta`` as the azimuthal angle
    and ``phi`` as the polar angle.

    Note that SciPy's spherical harmonics include the Condon-Shortley
    phase [2]_ because it is part of `sph_legendre_p`.

    With SciPy's conventions, the first several spherical harmonics
    are

    .. math::

        Y_0^0(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{1}{\pi}} \\
        Y_1^{-1}(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{3}{2\pi}}
                                    e^{-i\phi} \sin(\theta) \\
        Y_1^0(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{3}{\pi}}
                                 \cos(\theta) \\
        Y_1^1(\theta, \phi) &= -\frac{1}{2} \sqrt{\frac{3}{2\pi}}
                                 e^{i\phi} \sin(\theta).

    References
    ----------
    .. [1] Digital Library of Mathematical Functions, 14.30.
           https://dlmf.nist.gov/14.30
    .. [2] https://en.wikipedia.org/wiki/Spherical_harmonics#Condon.E2.80.93Shortley_phase
    T)r   rz   c                 ón   — t          | dd¬¦  «        } d| cxk    rdk    sn t          d| › d�¦  «        ‚| S r|   r‚   ry   s    r   rƒ   rƒ     r„   r   c                 ó  — | j         d         dk    r| d         S | j         d         dk    r| d         | dddgddgf         fS | j         d         dk    r-| d         | dddgddgf         | dddgddggddgddggf         fS d S ©Nr‡   r   ).r   r   r   .r   é   ©rX   rŠ   s    r   rƒ   rƒ     óº   € àŒ	�"Œ˜ÒÐØ�9Œ~ÐàŒ	�"Œ˜ÒÐØ�9Œ~˜s 3¨¨A¨°°A°Ð#6Ô7Ð7Ð7àŒ	�"Œ˜ÒÐØ�I”  C¨!¨Q¨°!°Q°Ð$7Ô 8Ø��q˜!�f˜q !˜fÐ%¨¨A¨°°A°Ð'7Ð7Ô8ð:ð 	:ð 	Ðr   aX  sph_harm_y_all(n, m, theta, phi, *, diff_n=0)

    All spherical harmonics up to the specified degree ``n`` and order ``m``.

    Output shape is ``(n + 1, 2 * m + 1, ...)``. The entry at ``(j, i)``
    corresponds to degree ``j`` and order ``i`` for all  ``0 <= j <= n``
    and ``-m <= i <= m``.

    See Also
    --------
    sph_harm_y
    c                 ón   — t          | dd¬¦  «        } d| cxk    rdk    sn t          d| › d�¦  «        ‚| S )Nrz   Fr}   r   r   z=diff_n is currently only implemented for orders 2, received: r�   r‚   ry   s    r   rƒ   rƒ   =  r„   r   c                 ó   — dddgdgz   iS )Nr�   r   )r   r   éþÿÿÿr‡   r   ry   s    r   rƒ   rƒ   H  s   € à�R˜�H Ð/Ñ/Ð0Ð0r   c                 óè   — |d         }t          | t          j        ¦  «        r| dk     rt          d¦  «        ‚| dz   dt	          |¦  «        z  dz   ft          j        ||¦  «        z   |dz   |dz   fz   fS )Nrz   r   r‘   r   r   r¥   )r•   r–   r—   Ú	phi_shaperi   r   rz   s          r   rƒ   rƒ   M  sƒ   € à�HÔ€Få�a�Ô)Ñ*Ô*ð >¨q°1ªu¨uÝÐ<Ñ=Ô=Ð=à�‰U�A�˜A™œ‘J ‘NÐ#¥bÔ&9¸+ÀyÑ&QÔ&QÑQØ	�!‰�V˜a‘ZÐ ñ!ð #ð #r   c                 ó  — | j         d         dk    r| d         S | j         d         dk    r| d         | dddgddgf         fS | j         d         dk    r-| d         | dddgddgf         | dddgddggddgddggf         fS d S r³   rµ   rŠ   s    r   rƒ   rƒ   X  r¶   r   )r$   r’   Únumpyr"   Ú_input_validationr   Ú_special_ufuncsr   r   r   r	   Ú_gufuncsr
   r   r   r   Ú__all__r   rD   rƒ   rN   rH   rL   rF   r   r   r   ú<module>rÂ      sl  ðØ Ð Ð Ð Ø €€€Ø Ð Ð Ð à 2Ð 2Ð 2Ð 2Ð 2Ð 2ð:ð :ð :ð :ð :ð :ð :ð :ð :ð :ð :ð :ð;ð ;ð ;ð ;ð ;ð ;ð ;ð ;ð ;ð ;ð ;ð ;ð	ð 	ð 	€ðsð sð sð sð sñ sô sð sðl �Øð ð@ ðE#ñ #ô #€ðL Ôðð ñ Ôðð Ô&ð#ð #ñ 'Ô&ð#ð  �ZØðð ðñ ô Ð ð$ Ô!ðð ñ "Ô!ðð Ô2ð)ð )ñ 3Ô2ð)ð Ô0ðDð Dñ 1Ô0ðDð Ô*ð#ð #ñ +Ô*ð#ð �:Øð$ðH ˜E¨!ðM'ñ 'ô 'Ð ðT Ôðð ñ  Ôðð Ô.ðð ñ /Ô.ðð Ô(ð#ð #ñ )Ô(ð#ð "�zØðð ˜E¨!ðñ ô Ð ð$ Ô#ðð ñ $Ô#ðð Ô2ðð ñ 3Ô2ðð Ô4ð-ð -ñ 5Ô4ð-ð Ô2ð	Ið 	Iñ 3Ô2ð	Ið Ô,ð#ð #ñ -Ô,ð#ð ˆZØðð8 ð=ñ ô €
ðD Ôð
ð 
ñ Ôð
ð Ô"ð#ð #ñ #Ô"ð#ð �Øðð ðñ ô €ð" Ôðð ñ Ôðð Ô.ð#ð #ñ /Ô.ð#ð Ô,ð8ð 8ñ -Ô,ð8ð Ô&ð#ð #ñ 'Ô&ð#ð ˆZØð=ðz #¨1ð@ñ @ô @€
ðF Ôðð ñ Ôðð Ô"ð	:ð 	:ñ #Ô"ð	:ð �Øðð #¨1ðñ ô €ð" Ôðð ñ Ôðð Ô.ð1ð 1ñ /Ô.ð1ð Ô,ð#ð #ñ -Ô,ð#ð Ô&ð	:ð 	:ñ 'Ô&ð	:ð 	:ð 	:r   