
    ^Mh              	           d dl Z d dlZd dlmZ d dlmc mZ d dl	m
Z
 d dlmZmZmZmZmZ dgZddddddddd	d
Zd ZdZd Zd Zd Zd Zd Zd Zd Zd Zd Zddd ed          dddZddZ d Z!dS )    N)special)_RichResult)array_namespacexp_copyxp_ravelxp_realxp_take_along_axisnsum F   )argslogmaxlevelminlevelatolrtolpreserve_shapecallbackc                
  0123 d}t          | ||||||	|
          \  } }}}}}}	}
3t          j        ddd          5  3                    t	          |          t	          |          z   dz  |j                  }3                    |          3                    |          }}||         dz
  ||<   ||         dz   ||<   d|||z  <   t          j        | |f|d|	3          }ddd           n# 1 swxY w Y   |\  } }}}}}3t	          3	                    3
                    ||          |                    }t	          3	                    3
                    ||          |                    }t          ||3          \  }}}2}}}d	\  }}r3j         nd
}3                    3j        |          d         }|z
  dz   }3                    |          j        }rdt#          j        |          z  n|dz  t	          3                    |||                    03j        03                    |          3                    |          z  3                    |d
                   z  <   3                    3                    0          d          ddd
d
f         }t	          3                    |3j        |                    }t	          3                    |t          j        3j                            } t3          |3          1t5          1          1t	          3                    |3j         |                    }!t	          3                    |3j        |                    }"t	          3                    ||                    }#t	          3                    |3j        |                    }$t	          3                    |3j        |                    }%t	          3                    ||                    }&t	          3                    ||                    }'t9          di d0d|d|d1dd|d|d|d3                    |d          d3                    |d          dd|d|d| d|!d|"d |#d!|$d"|%d#|&d$|'d%|d&|d'|d(3                    |d          d)t9          ddd
gd*          }(g d+})13fd,}*3fd-}+03fd.},3fd/}-23fd0}.t          j        ddd          5  t          j        |(|
||| |||*|+|,|-|.|)3|	          }/ddd           n# 1 swxY w Y   |/S )1u25  Evaluate a convergent integral numerically using tanh-sinh quadrature.

    In practice, tanh-sinh quadrature achieves quadratic convergence for
    many integrands: the number of accurate *digits* scales roughly linearly
    with the number of function evaluations [1]_.

    Either or both of the limits of integration may be infinite, and
    singularities at the endpoints are acceptable. Divergent integrals and
    integrands with non-finite derivatives or singularities within an interval
    are out of scope, but the latter may be evaluated be calling `tanhsinh` on
    each sub-interval separately.

    Parameters
    ----------
    f : callable
        The function to be integrated. The signature must be::

            f(xi: ndarray, *argsi) -> ndarray

        where each element of ``xi`` is a finite real number and ``argsi`` is a tuple,
        which may contain an arbitrary number of arrays that are broadcastable
        with ``xi``. `f` must be an elementwise function: see documentation of parameter
        `preserve_shape` for details. It must not mutate the array ``xi`` or the arrays
        in ``argsi``.
        If ``f`` returns a value with complex dtype when evaluated at
        either endpoint, subsequent arguments ``x`` will have complex dtype
        (but zero imaginary part).
    a, b : float array_like
        Real lower and upper limits of integration. Must be broadcastable with one
        another and with arrays in `args`. Elements may be infinite.
    args : tuple of array_like, optional
        Additional positional array arguments to be passed to `f`. Arrays
        must be broadcastable with one another and the arrays of `a` and `b`.
        If the callable for which the root is desired requires arguments that are
        not broadcastable with `x`, wrap that callable with `f` such that `f`
        accepts only `x` and broadcastable ``*args``.
    log : bool, default: False
        Setting to True indicates that `f` returns the log of the integrand
        and that `atol` and `rtol` are expressed as the logs of the absolute
        and relative errors. In this case, the result object will contain the
        log of the integral and error. This is useful for integrands for which
        numerical underflow or overflow would lead to inaccuracies.
        When ``log=True``, the integrand (the exponential of `f`) must be real,
        but it may be negative, in which case the log of the integrand is a
        complex number with an imaginary part that is an odd multiple of π.
    maxlevel : int, default: 10
        The maximum refinement level of the algorithm.

        At the zeroth level, `f` is called once, performing 16 function
        evaluations. At each subsequent level, `f` is called once more,
        approximately doubling the number of function evaluations that have
        been performed. Accordingly, for many integrands, each successive level
        will double the number of accurate digits in the result (up to the
        limits of floating point precision).

        The algorithm will terminate after completing level `maxlevel` or after
        another termination condition is satisfied, whichever comes first.
    minlevel : int, default: 2
        The level at which to begin iteration (default: 2). This does not
        change the total number of function evaluations or the abscissae at
        which the function is evaluated; it changes only the *number of times*
        `f` is called. If ``minlevel=k``, then the integrand is evaluated at
        all abscissae from levels ``0`` through ``k`` in a single call.
        Note that if `minlevel` exceeds `maxlevel`, the provided `minlevel` is
        ignored, and `minlevel` is set equal to `maxlevel`.
    atol, rtol : float, optional
        Absolute termination tolerance (default: 0) and relative termination
        tolerance (default: ``eps**0.75``, where ``eps`` is the precision of
        the result dtype), respectively.  Iteration will stop when
        ``res.error < atol`` or  ``res.error < res.integral * rtol``. The error
        estimate is as described in [1]_ Section 5 but with a lower bound of
        ``eps * res.integral``. While not theoretically rigorous or
        conservative, it is said to work well in practice. Must be non-negative
        and finite if `log` is False, and must be expressed as the log of a
        non-negative and finite number if `log` is True.
    preserve_shape : bool, default: False
        In the following, "arguments of `f`" refers to the array ``xi`` and
        any arrays within ``argsi``. Let ``shape`` be the broadcasted shape
        of `a`, `b`, and all elements of `args` (which is conceptually
        distinct from ``xi` and ``argsi`` passed into `f`).

        - When ``preserve_shape=False`` (default), `f` must accept arguments
          of *any* broadcastable shapes.

        - When ``preserve_shape=True``, `f` must accept arguments of shape
          ``shape`` *or* ``shape + (n,)``, where ``(n,)`` is the number of
          abscissae at which the function is being evaluated.

        In either case, for each scalar element ``xi[j]`` within ``xi``, the array
        returned by `f` must include the scalar ``f(xi[j])`` at the same index.
        Consequently, the shape of the output is always the shape of the input
        ``xi``.

        See Examples.

    callback : callable, optional
        An optional user-supplied function to be called before the first
        iteration and after each iteration.
        Called as ``callback(res)``, where ``res`` is a ``_RichResult``
        similar to that returned by `_differentiate` (but containing the
        current iterate's values of all variables). If `callback` raises a
        ``StopIteration``, the algorithm will terminate immediately and
        `tanhsinh` will return a result object. `callback` must not mutate
        `res` or its attributes.

    Returns
    -------
    res : _RichResult
        An object similar to an instance of `scipy.optimize.OptimizeResult` with the
        following attributes. (The descriptions are written as though the values will
        be scalars; however, if `f` returns an array, the outputs will be
        arrays of the same shape.)

        success : bool array
            ``True`` when the algorithm terminated successfully (status ``0``).
            ``False`` otherwise.
        status : int array
            An integer representing the exit status of the algorithm.

            ``0`` : The algorithm converged to the specified tolerances.
            ``-1`` : (unused)
            ``-2`` : The maximum number of iterations was reached.
            ``-3`` : A non-finite value was encountered.
            ``-4`` : Iteration was terminated by `callback`.
            ``1`` : The algorithm is proceeding normally (in `callback` only).

        integral : float array
            An estimate of the integral.
        error : float array
            An estimate of the error. Only available if level two or higher
            has been completed; otherwise NaN.
        maxlevel : int array
            The maximum refinement level used.
        nfev : int array
            The number of points at which `f` was evaluated.

    See Also
    --------
    quad

    Notes
    -----
    Implements the algorithm as described in [1]_ with minor adaptations for
    finite-precision arithmetic, including some described by [2]_ and [3]_. The
    tanh-sinh scheme was originally introduced in [4]_.

    Due to floating-point error in the abscissae, the function may be evaluated
    at the endpoints of the interval during iterations, but the values returned by
    the function at the endpoints will be ignored.

    References
    ----------
    .. [1] Bailey, David H., Karthik Jeyabalan, and Xiaoye S. Li. "A comparison of
           three high-precision quadrature schemes." Experimental Mathematics 14.3
           (2005): 317-329.
    .. [2] Vanherck, Joren, Bart Sorée, and Wim Magnus. "Tanh-sinh quadrature for
           single and multiple integration using floating-point arithmetic."
           arXiv preprint arXiv:2007.15057 (2020).
    .. [3] van Engelen, Robert A.  "Improving the Double Exponential Quadrature
           Tanh-Sinh, Sinh-Sinh and Exp-Sinh Formulas."
           https://www.genivia.com/files/qthsh.pdf
    .. [4] Takahasi, Hidetosi, and Masatake Mori. "Double exponential formulas for
           numerical integration." Publications of the Research Institute for
           Mathematical Sciences 9.3 (1974): 721-741.

    Examples
    --------
    Evaluate the Gaussian integral:

    >>> import numpy as np
    >>> from scipy.integrate import tanhsinh
    >>> def f(x):
    ...     return np.exp(-x**2)
    >>> res = tanhsinh(f, -np.inf, np.inf)
    >>> res.integral  # true value is np.sqrt(np.pi), 1.7724538509055159
    1.7724538509055159
    >>> res.error  # actual error is 0
    4.0007963937534104e-16

    The value of the Gaussian function (bell curve) is nearly zero for
    arguments sufficiently far from zero, so the value of the integral
    over a finite interval is nearly the same.

    >>> tanhsinh(f, -20, 20).integral
    1.772453850905518

    However, with unfavorable integration limits, the integration scheme
    may not be able to find the important region.

    >>> tanhsinh(f, -np.inf, 1000).integral
    4.500490856616431

    In such cases, or when there are singularities within the interval,
    break the integral into parts with endpoints at the important points.

    >>> tanhsinh(f, -np.inf, 0).integral + tanhsinh(f, 0, 1000).integral
    1.772453850905404

    For integration involving very large or very small magnitudes, use
    log-integration. (For illustrative purposes, the following example shows a
    case in which both regular and log-integration work, but for more extreme
    limits of integration, log-integration would avoid the underflow
    experienced when evaluating the integral normally.)

    >>> res = tanhsinh(f, 20, 30, rtol=1e-10)
    >>> res.integral, res.error
    (4.7819613911309014e-176, 4.670364401645202e-187)
    >>> def log_f(x):
    ...     return -x**2
    >>> res = tanhsinh(log_f, 20, 30, log=True, rtol=np.log(1e-10))
    >>> np.exp(res.integral), np.exp(res.error)
    (4.7819613911306924e-176, 4.670364401645093e-187)

    The limits of integration and elements of `args` may be broadcastable
    arrays, and integration is performed elementwise.

    >>> from scipy import stats
    >>> dist = stats.gausshyper(13.8, 3.12, 2.51, 5.18)
    >>> a, b = dist.support()
    >>> x = np.linspace(a, b, 100)
    >>> res = tanhsinh(dist.pdf, a, x)
    >>> ref = dist.cdf(x)
    >>> np.allclose(res.integral, ref)
    True

    By default, `preserve_shape` is False, and therefore the callable
    `f` may be called with arrays of any broadcastable shapes.
    For example:

    >>> shapes = []
    >>> def f(x, c):
    ...    shape = np.broadcast_shapes(x.shape, c.shape)
    ...    shapes.append(shape)
    ...    return np.sin(c*x)
    >>>
    >>> c = [1, 10, 30, 100]
    >>> res = tanhsinh(f, 0, 1, args=(c,), minlevel=1)
    >>> shapes
    [(4,), (4, 34), (4, 32), (3, 64), (2, 128), (1, 256)]

    To understand where these shapes are coming from - and to better
    understand how `tanhsinh` computes accurate results - note that
    higher values of ``c`` correspond with higher frequency sinusoids.
    The higher frequency sinusoids make the integrand more complicated,
    so more function evaluations are required to achieve the target
    accuracy:

    >>> res.nfev
    array([ 67, 131, 259, 515], dtype=int32)

    The initial ``shape``, ``(4,)``, corresponds with evaluating the
    integrand at a single abscissa and all four frequencies; this is used
    for input validation and to determine the size and dtype of the arrays
    that store results. The next shape corresponds with evaluating the
    integrand at an initial grid of abscissae and all four frequencies.
    Successive calls to the function double the total number of abscissae at
    which the function has been evaluated. However, in later function
    evaluations, the integrand is evaluated at fewer frequencies because
    the corresponding integral has already converged to the required
    tolerance. This saves function evaluations to improve performance, but
    it requires the function to accept arguments of any shape.

    "Vector-valued" integrands, such as those written for use with
    `scipy.integrate.quad_vec`, are unlikely to satisfy this requirement.
    For example, consider

    >>> def f(x):
    ...    return [x, np.sin(10*x), np.cos(30*x), x*np.sin(100*x)**2]

    This integrand is not compatible with `tanhsinh` as written; for instance,
    the shape of the output will not be the same as the shape of ``x``. Such a
    function *could* be converted to a compatible form with the introduction of
    additional parameters, but this would be inconvenient. In such cases,
    a simpler solution would be to use `preserve_shape`.

    >>> shapes = []
    >>> def f(x):
    ...     shapes.append(x.shape)
    ...     x0, x1, x2, x3 = x
    ...     return [x0, np.sin(10*x1), np.cos(30*x2), x3*np.sin(100*x3)]
    >>>
    >>> a = np.zeros(4)
    >>> res = tanhsinh(f, a, 1, preserve_shape=True)
    >>> shapes
    [(4,), (4, 66), (4, 64), (4, 128), (4, 256)]

    Here, the broadcasted shape of `a` and `b` is ``(4,)``. With
    ``preserve_shape=True``, the function may be called with argument
    ``x`` of shape ``(4,)`` or ``(4, n)``, and this is what we observe.

    Nignore)overinvaliddivider   g      ?        T)
complex_okr   xpr      r   dtyper   r   g      ?r   SnSkaerrhr   r    piepsabnnitnfevstatusxr0fr0wr0xl0fl0wl0d4ainfbinfabinfa0
pair_cache)xjcwjindicesh0))r.   r.   )integralr#   )errorr%   )r,   r,   )r-   r-   c                    d| j         z  z  | _        t          | j         | j        | j         k    |           \  }}t	          ||| j        | j                  \  | _        | _        t          | j                  }|| j
                 dt          || j
                           dz  z
  z  || j
        <   d|| j                 z  dz
  | j        | j                 z   || j        <   || j        xx         dz  cc<   |S )Nr   )r    	inclusiver   workr   r"   )r+   r&   
_get_pairsr    _transform_to_limitsr)   r*   xjr<   r   r8   r   r7   r9   r6   )rC   r;   r<   rF   r>   r   r   s       Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/integrate/_tanhsinh.pypre_func_evalztanhsinh.<locals>.pre_func_eval  s    aiTVRtz(,((:O O OR/RLL TWDJ1wr$*~/F/F/I+IJ4:"TY-!+dgdi.@@49
49	    c           
      d   |j         r||j        xx                              d|j        |j                 dz  z             d                     d|j        |j                 dz  z
            z  z
  z  cc<   ||j        xx         d                     |j        |j                           z  z  cc<   no||j        xx         d|j        |j                 dz  z   d|j        |j                 dz  z
  dz  z  z  cc<   ||j        xx         |j        |j                 dz  z  cc<   t	          ||          \  }}|j        j        d         r[|j        d d df         }r@t          j        	                    |t          j         d          z
  |g          d          n|dz  |z   }||_        ||_        d S )Nr   r   g       r"   r   axis)r   r8   rF   r7   _euler_maclaurin_sumr$   shaper   	logsumexpstackmathfjwjr#   )xfjrC   rR   r#   Snm1r   r   s         rG   post_func_evalz tanhsinh.<locals>.post_func_eval  s   8 	5tzNNNrvva$'$**=q*@&@AA!"266!dgdj.A1.D*D#E#E!E F GNNNtyMMMQ	(:!;!;;;MMMMtzNNNDGDJ$7$: : !DGDJ$7$: :Q> ? @NNNtyMMMTWTY/44MMM (D"55b7= 	&7111b5>DSV %'#BHHdTXa[[.@"-E$F$FQOOOOax"}  	rI   c                                         | j        j        t                    }| j        dk    rt          | j        | j        k              }                    
rj	         nd          }
                    | j        j        |j                  }j        |                              <   ||         | j        |<   ||         | j        |<   t          j        | j        |<   d||<   nwt%          |           \  }}|k     |	k     z  }                                        || j                  | j        j                  | _        t          j        | j        |<   d||<   
rRt+          | j                  }                    |          |dk    z  }|                    | j                  z  | z  }n                    | j                   | z  }t          j        | j        |<   d||<   |S )z>Terminate due to convergence or encountering non-finite valuesr   r   r   T)zerosr#   rN   boolr,   r   r)   r*   asarrayinffullr    nanisnanr%   eim_ECONVERGEDr.   _estimate_errorreshapeastyper   isinfisfinite
_EVALUEERR)rC   stopizerorerrr%   Sn_real
Sn_pos_infr#   r   r   r   r   s           rG   check_terminationz#tanhsinh.<locals>.check_termination  s   xxTx22 8q==46)**A::4rvgg"55D7747=$bh7??D!#D"aDGAJ7DIaL _DKNDGG )r22JD$-ABIIdDJ$?$?OODI _DKNDG  	.dg&&G'**gk:Jbhhtw///D58AATW%%%-AAQrI   c                     | xj         dz  c_                             | j        | j        d d j        f         fd          | _        d S )Nr   r"   rK   )r+   concatr$   r#   newaxis)rC   r   s    rG   post_termination_checkz(tanhsinh.<locals>.post_termination_check  sF    !))TWdgaaam&<=B)GGrI   c                    r{                               rf| d         j        }                    j        |          d         }                    dj                  d         }| d         |z  |z  z   | d<   n| d         xx         dz  cc<   | d         z   dz
  | d<   d| d         | d         d	k    <   | d= |S )
Nr?   r   r                 ?r"   r,   r   r   r   )anyr    rZ   r'   	complex64)	resrN   r    r'   jr   r   negativer   s	        rG   customize_resultz"tanhsinh.<locals>.customize_result  s      	,266(## 	,
O)EBE//3B

2R\
2226A!*oA=C
OO
OH%%%+%%% #SZ/!3J+-JE
a(JrI   )_tanhsinh_ivnperrstaterb   r   rN   rd   r_   _initializerc   broadcast_to_transform_integralsr[   rZ   r'   finfor(   rQ   r   r\   r]   r^   
empty_like_EINPROGRESSint32_get_base_stepr   rX   r   _loop)4fr)   r*   r   r   r   r   r   r   r   r   maxfuncinf_ainf_btempxsfsrN   r    r9   r8   r6   r7   r,   r-   ri   r'   maxiterr(   r$   r%   r.   r/   r0   r1   r2   r3   r4   r5   rC   res_work_pairsrH   rV   rm   rq   ry   rv   r#   r>   rx   r   s4       ` ```                                       @@@@rG   tanhsinhr      s^   J	 F7C	1afh$dNH8. 8.5Q1c68X	4~x 
(HX	F	F	F E EJJhqkk114ag>>xx{{BHHQKKuU8b=%U8b=%%%-q1$.<E E EE E E E E E E E E E E E E E E )-%Ar2tUE22??1e44e<<==A2??1e44e<<==A -AAr,J,J)Aq"htT IC BF77qD	BE	'	'	+B!A%G
((5//
C|%(7tDHSMM!!c4i	"''%U'33	4	4B68fBrxx{{RXXa[[ 288BqE??23	BMM"%%w	/	/1Q3	7BBGGE26G7788DbggeS%5RXgFFGGF	r	"	"B	B
 277526'777
8
8C
2775"&766
7
7C
288E8//
0
0C
2775"&766
7
7C
2775"&766
7
7C
288E8//
0
0C	"((5(..	/	/B I I I2I"I4I#%2I+.3I6;eI@BIHKI
**Q
 
 
 I$&JJq'$:$:$:I (I I #'$I 06vI C	I S	I "c	I (+s	I 14	I :=	I BD	I
 TI
 I
 %*EI
 /1jjW.E.E.EI 4D1#$GGGGIDK K KN           *                 D    
       ( 
(HX	F	F	F N Nihw4&(9;Q(."nN NN N N N N N N N N N N N N N N Js%   
B%C;;C?C?+#UU!Uc                     d|                     |           j        z  }t          j        t          j        d|z  dz
            |j        z            }|t          z  }|                    ||           d         S )N   r   r   r   r   )r   smallest_normalrQ   asinhr   r'   _N_BASE_STEPSrZ   )r    r   fmintmaxr>   s        rG   r   r     sj     RXXe__,,D:dhqvz**RU233D 
	B::b:&&r**rI      c                    |d| z  z  }t           d| z  z  }| dk    r|                    |dz             n|                    d|dz   d          }||z  }|j        dz  }||                    |          z  }||                    |          z  }	||                    |	          dz  z  }
d|                    |	          |                    |	          z  z  }| dk    r|
d         dz  n|
d         |
d<   ||
fS Nr   r   r   )r   aranger'   coshsinhexp)kr>   r   r&   maxrw   jhpi_2u1u2r<   r;   s               rG   _compute_pairr     s     	QT	A
!Q$
C FF		#a%		!SUA(>(>A	
QB 519D	bggbkk	B	bggbkk	B 
bggbkk1n	B
rvvbzzBGGBKK'
(C aBqEAIIRUBqE7NrI   c                 (   t          |t          |j        j                            r||j        j        k    rK|                    d          |j        _        |                    d          |j        _        dg|j        _        |j        j        g}|j        j        g}t          t          |j        j                  dz
  | dz             D ]}}t          |||          \  }}|                    |           |                    |           |j        j                            |j        j        d         |j        d         z              ~|                    |          |j        _        |                    |          |j        _        ||j        _        d S )Nr   r   r"   )
isinstancetyper:   r>   emptyr;   r<   r=   rangelenr   appendrN   ro   )	r   r>   r   rC   xjcswjsrh   r;   r<   s	            rG   _pair_cacher   0  sP   
 b$t12233 &rT_=O7O7O hhqkkXXa[[#$#O D?
C3t.//11q599 S S2r**RC

2&&t'>r'BSYq\'QRRRR))D//DO3DODOrI   c                    t          |j        j                  | dz   k    s7t          |t	          |j        j                            r||j        j        k    rt          | |||           |j        j        }|j        j        }|j        j        }|rdn||          }	|| dz            }
|	                    ||	|
         |          |	                    ||	|
         |          fS r   )
r   r:   r=   r   r   r>   r   r;   r<   rc   )r   r>   rB   r    r   rC   r;   r<   r=   startends              rG   rD   rD   H  s     	DO#$$!++2tDO$67788 	,###2r4(((
/
C		Bo%G*AA
E
!A#,C99Ss^U++RYYr%)}e-L-LLLrI   c                     ||z
  dz  }|                     | | z  |z   || z  |z   fd          }||z  }|                     ||fd          }t          |          t          |          t          |          }	}}||k    ||	k    z  }
d||
<   ||fS )Nr   r"   rK   r   )ro   r   )r;   r<   r)   r*   r   alpharF   xj_reala_realb_realr   s              rG   rE   rE   Z  s    
 UaKE	UFSL1$eckAo6R	@	@B	EB	B8"	%	%B &bkk71::wqzzVVG& W%67GBwKr6MrI   c                 2   |j         |j        |j        }}}|j        |j        |j        }}}|j        j        | j        |j        j        }
} }	|	j	        \  }}t          |                    |	d|dz  |f                    \  }}|                    | d|dz  |f          \  }}|                    |
d|dz  |f          \  }}|                    |           |dk    z  }|                    |           |dk    z  }|j         ||<   |                    t          |          dd          }t!          ||d          d         }t!          ||d          d         }t!          ||d          d         }t          |          t          |          k    }||         ||<   ||         ||<   ||         ||<   |j        ||<   |                    t          |          dd          }t!          ||d          d         }t!          ||d          d         }t!          ||d          d         }t          |          t          |          k     }||         ||<   ||         ||<   ||         ||<   | j        } |j        r||                    |          z   n||z  }|j        r||                    |          z   n||z  }|j        rt          n|j        } |                     | |           | |                    |_        |                    ||j        d d f         |j	                  }!|                    ||j        d d f         |j	                  }"|!|         ||<   |"|         ||<   |j        r| |                    |j                  z   n	| |j        z  }#|j        r1t1          j        |#|                    |j                  z   d          n|                    |#d          |j        z  }$|||c|_         |_        |_        |||c|_        |_        |_        |#|$fS )Nr   r   TrL   keepdimsrK   r"   )r/   r0   r1   r2   r3   r4   rF   Tr<   rN   r   rb   re   r[   argmaxr   r	   argminr   absmaximumr5   r~   rp   r   rO   r&   sum)%rT   rC   r   r/   r0   r1   r2   r3   r4   rF   r<   n_xn_activexrxlfrflwrwl	invalid_r	invalid_lirxr_maxfr_maxwr_maxrw   ilxl_minfl_minwl_minflwl0frwr0	magnitudefr0bfl0brR   r#   s%                                        rG   rM   rM   p  s    HdhcCHdhcC BD$')BBHMC RZZQq($;<<==FBZZQq(344FBZZQq(344FBR B!G,IR B!G,I VGByM	72;;Q	6	6B  BQ///2FBQ///2FBQ///2F 	'#,,&AAYCFAYCFAYCF FByM	72;;Q	6	6BBQ///2FBQ///2FBQ///2F 	'#,,&AAYCFAYCFAYCF	B "&8C"&&++sSyE!%8C"&&++sSyE8/Ijj5))99U+;+;<<DG ??3rz111}-rx88D??3rz111}-rx88DOByMOByM $(8=2twdgD @Dx .'
D266$&>>1
;
;
;
;vvdv$$tv-  $'S DHdh#&S DHdh8OrI   c           
      t
   | j         dk    s| j        dk    r$|                    | j        |j                  }||fS | j        j        }| j        j        d         }t          dd          }| j	        j        d         dk    rd| j
        z  }|| j                  }|                    | j        |ddf          }|                    |d d d d d |f         |d|z  f          }	| j        r(t          j        |	fi ||                    |          z   n |j        |	fi ||z  }
|                    |
| j	        fd          | _	        | j         dk    r$|                    | j        |j                  }||fS | j	        j        d         dk     rd| j
        z  }|| j         dz
           }|                    | j        | j        j        d         ddf          }|                    |d	d |f         |d|z  f          }	| j        r(t          j        |	fi ||                    |          z   n |j        |	fi ||z  }|                    || j	        fd          | _	        | j	        d
         }| j	        d         }
|                    | j                  d         }| j        ru|                    |          }t)          t          j        |                    | j        |
| j        dz  z   g          d                    }t)          t          j        |                    | j        || j        dz  z   g          d                    }||                    t)          | j                  d          z   }| j        }||                    | j                  z   }|                    ||j         k    |dz  |z  |j                   }|                    |d|z  |||g          }|                    |d          }||                    | j                  z
  }n(|                    | j        |
z
            }|                    | j        |z
            }||                    |                    | j                  d          z  }| j        }||                    | j                  z  }|                    |dk    ||                    |          |                    |          z  z  d          }|                    ||dz  |||g          }|                    |d          }||                    | j                  z  }||fS )Nr   r"   Tr   r   rK   r   r   .).).r"   r   rs   )r+   r,   	full_liker#   r]   r:   r=   rN   dictr$   r&   rb   rR   r   r   rO   r   ro   rZ   r(   r   rP   r'   r   r5   realwherer[   r   )rC   r   r]   r=   r   axis_kwargsr&   r   fjwj_rlrR   rU   Snm2e1log_e1d1d2d3r5   d5r   dsr%   rj   s                          rG   ra   ra     s    v{{dh!mm ll47BF++Cxo%Gw}QHB...K w}RAJdfo **TY1b(9::zz'!!!QQQ*-!C%/@AAFJh 5!$66+66BBRVD00K0014 	))T47O")55v{{ll47BF++Cx
 w}R1JdfQh **TYq)91b(ABBzz'#tt),x3.?@@FJh 5!$66+66BBRVD00K0014 	))T47O")5577D77D	DH		b	!Bx $
 W&rxx$:K0L'M'MTUVVVWWW&rxx$:K0L'M'MTUVVVWWbffWTY//bf999Wbggdg&&&xxbfWbAglRVG<<XXtQVRR011vvbqv!!bggdg&&& VVDGdN##VVDGdN##"&&	**&444W"&&//!xxQRVVBZZr

%: ;Q??XXtRUBB/00vvbqv!!BFF47OO#:rI   c                    | |k    }d\  | |<   ||<   t          |          t          |           k     }||         | |         c| |<   ||<   |                    |           |                    |          z  }d\  | |<   ||<   |                    |           }||          | |          c| |<   ||<   |                    |          }t          |           }d\  | |<   ||<   | ||||||fS )N)r   r   r!   r   )r   rd   r   )	r)   r*   r   ab_samerx   r8   r6   r7   r9   s	            rG   r   r     s     AvG!AgJ'
 qzzGAJJ&H {AhKAhK8HHQKK"((1++%EAeHah88A;;D$x!D'AdGQtW88A;;D	BAdGQtWaXudD00rI   c                    t          ||          d}t          |           st          |          d}                    |                              |          }}                    ||          \  }}                    |j        d          s                    |j        d          rt          |          d}|dvrt          |          t          |          }||rj         nd}||nd}t          j        ||dg          }d}t          j
        |j        t          j                  st          |          |r8d	}t          j        t          j        |                    rt          |          nOd
}t          j        |dk               s&t          j        t          j        |                    rt          |          |d         }||n|d         }t          d          }||d}||n|}||n|}d}t          j        |||g          }t          j
        |j        t          j                  r[t          j        t          j        |                    r5t          j        |                    t          j                  |k              st          |          d}t          j        |dk               rt          |          |                    t          j                  \  }}}t+          ||          }t          j        |	          s|	f}	fd|	D             }	d}|
dvrt          |          |t          |          st          d          | |||||||||	|
|fS )N`f` must be callable.z1All elements of `a` and `b` must be real numbers.complex floating`log` must be True or False.   FTr   r   '`atol` and `rtol` must be real numbers.z/`atol` and `rtol` may not be positive infinity.z2`atol` and `rtol` must be non-negative and finite.r   l            
   z6`maxfun`, `maxlevel`, and `minlevel` must be integers.z:`maxfun`, `maxlevel`, and `minlevel` must be non-negative.c              3   B   K   | ]}                     |          V  d S N)rZ   .0argr   s     rG   	<genexpr>z_tanhsinh_iv.<locals>.<genexpr>x  s-      ,,BJJsOO,,,,,,rI   z'`preserve_shape` must be True or False.z`callback` must be callable.)r   callable
ValueErrorrZ   broadcast_arraysisdtyper    rY   r[   r{   
issubdtypefloatingrt   isposinfrd   floatnumberallisrealrc   int64miniterable)r   r)   r*   r   r   r   r   r   r   r   r   r   message	rtol_tempparamsBIGINTr   s                   @rG   rz   rz   7  s    
A		B%GA;; "!!!AG::a=="**Q--qAq!$$DAq


17.// "zz!'#566"!!!,G
-!!!
s))C|$ww1(bI Zy"-..F7G=r{33 "!!!
 &C6"+f%%&& 	&W%%%	& G6&1* 	&(8(8!9!9 	&W%%%!9D<44VAYD5\\F~(*~VV6F!)vvxHFGZ8455FM&,	22 "ry(())"v}}RX..&899" !!!JG	vfqj "!!!!'rx!8!8FHh8X&&H;t w,,,,t,,,D7G]**!!!HX$6$67888q!S&(H$nh< <rI   c                 P   t          ||          }d}	t          |           st          |	          d}	|                    |                    |          |                    |          |                    |                    \  }}}|                    |j        |j        |j                  }
|                    |
d          r|                    |
d          rt          |	          ||k    }|                    |          |dk    z  }||z  }d}	|dvrt          |	          |i n|}|	                    dd           }||r|j
         nd}|	                    d	d           }||nd
}t          j        ||d
g          }d}	t          j        |j        t          j                  st          |	          |rMd}	t          j        t          j        |          t          j        |          z            rt          |	          n?d}	t          j        |dk     t          j        |           z            rt          |	          |d         }||n|d         }t#          |          }||k    s|dk     rd}	t          |	          t          j        |          s|f}| ||||||||||fS )Nr   z:All elements of `a`, `b`, and `step` must be real numbers.numericr   r   r   r   r   r   r   r   z3`atol`, `rtol` may not be positive infinity or NaN.z3`atol`, and `rtol` must be non-negative and finite.r   z*`maxterms` must be a non-negative integer.)r   r   r   r   rZ   result_typer    r   re   getr[   r{   r   r   rt   r   r^   intr  )r   r)   r*   stepr   r   maxterms
tolerancesr   r  r    valid_b
valid_stepvalid_abstepr   r   r  r  maxterms_ints                      rG   _nsum_ivr    s    
A		B%GA;; "!!!JG$$RZZ]]BJJqMM2::dCSCSTTJAq$NN17AGTZ88E::eY'' "2::e=O+P+P "!!!1fGT""dQh/JZ'L,G
-!!!!)zJ>>&$''D|$ww1>>&$''D(bI Zy"-..F7G=r{33 "!!!
 &G6"+f%%(8(8899 	&W%%%	& H66A:2;v#6#6"6788 	&W%%%!9D<44VAYDx==Lx8a<<>!!!;t waD,c<tROOrI   r   i   )r  r   r   r  r  c                
    ! t           |||||||          }|\   }}}}	}}}}
}!t          j         |f|d!          }|\   }}}}}!|d         }!                    t	          !                    ||                    |          }!                    t	          !                    ||                    |          }t	          !                    |	|                    }	!                    ||z
  |z            }!                    |          }||         ||         ||         z  z   ||<   !                    |          j	        }!
                    |r!j         nd|          d         }||rdt          j        |          z  n|dz  }||||||
|f}!                    |          }!                    |          }!                    t!          |          !j                  }!                    t!          |          !j                  }|	 }|dz   |k    | z  !                    |           z  | z  !                    |           z   z  | z    z   z  | z   !                    |          r!j        !j        c||<   ||<   d	||<   !                              rfd
|D             }t+           |         |         |         ||!          }|dd	         \  |<   |<   |xx         |d	         z  cc<   d!
                    !                    |                    !j                  z  |<   !                              rbfd|D             }t-           |         |         |         ||!          }|dd	         \  |<   |<   |<   |xx         |d	         z  cc<   !                              rifd|D             } fd}t-          ||          |          |         ||!          }|dd	         \  |<   |<   |<   |xx         |d	         z  cc<   !                               r fd|D             }|r !fd}n !fd}!                    |                    }t-          |||          |          ||!          }|dd	         \  | <   | <   | <   | xx         d|d	         z  z  cc<   |                    |          d         |                    |          d         }}|                    |          d         |                    |          d         }}t3          ||||dk    |          S )aF!  Evaluate a convergent finite or infinite series.

    For finite `a` and `b`, this evaluates::

        f(a + np.arange(n)*step).sum()

    where ``n = int((b - a) / step) + 1``, where `f` is smooth, positive, and
    unimodal. The number of terms in the sum may be very large or infinite,
    in which case a partial sum is evaluated directly and the remainder is
    approximated using integration.

    Parameters
    ----------
    f : callable
        The function that evaluates terms to be summed. The signature must be::

            f(x: ndarray, *args) -> ndarray

        where each element of ``x`` is a finite real and ``args`` is a tuple,
        which may contain an arbitrary number of arrays that are broadcastable
        with ``x``.

        `f` must be an elementwise function: each element ``f(x)[i]``
        must equal ``f(x[i])`` for all indices ``i``. It must not mutate the
        array ``x`` or the arrays in ``args``, and it must return NaN where
        the argument is NaN.

        `f` must represent a smooth, positive, unimodal function of `x` defined at
        *all reals* between `a` and `b`.
    a, b : float array_like
        Real lower and upper limits of summed terms. Must be broadcastable.
        Each element of `a` must be less than the corresponding element in `b`.
    step : float array_like
        Finite, positive, real step between summed terms. Must be broadcastable
        with `a` and `b`. Note that the number of terms included in the sum will
        be ``floor((b - a) / step)`` + 1; adjust `b` accordingly to ensure
        that ``f(b)`` is included if intended.
    args : tuple of array_like, optional
        Additional positional arguments to be passed to `f`. Must be arrays
        broadcastable with `a`, `b`, and `step`. If the callable to be summed
        requires arguments that are not broadcastable with `a`, `b`, and `step`,
        wrap that callable with `f` such that `f` accepts only `x` and
        broadcastable ``*args``. See Examples.
    log : bool, default: False
        Setting to True indicates that `f` returns the log of the terms
        and that `atol` and `rtol` are expressed as the logs of the absolute
        and relative errors. In this case, the result object will contain the
        log of the sum and error. This is useful for summands for which
        numerical underflow or overflow would lead to inaccuracies.
    maxterms : int, default: 2**20
        The maximum number of terms to evaluate for direct summation.
        Additional function evaluations may be performed for input
        validation and integral evaluation.
    atol, rtol : float, optional
        Absolute termination tolerance (default: 0) and relative termination
        tolerance (default: ``eps**0.5``, where ``eps`` is the precision of
        the result dtype), respectively. Must be non-negative
        and finite if `log` is False, and must be expressed as the log of a
        non-negative and finite number if `log` is True.

    Returns
    -------
    res : _RichResult
        An object similar to an instance of `scipy.optimize.OptimizeResult` with the
        following attributes. (The descriptions are written as though the values will
        be scalars; however, if `f` returns an array, the outputs will be
        arrays of the same shape.)

        success : bool
            ``True`` when the algorithm terminated successfully (status ``0``);
            ``False`` otherwise.
        status : int array
            An integer representing the exit status of the algorithm.

            - ``0`` : The algorithm converged to the specified tolerances.
            - ``-1`` : Element(s) of `a`, `b`, or `step` are invalid
            - ``-2`` : Numerical integration reached its iteration limit;
              the sum may be divergent.
            - ``-3`` : A non-finite value was encountered.
            - ``-4`` : The magnitude of the last term of the partial sum exceeds
              the tolerances, so the error estimate exceeds the tolerances.
              Consider increasing `maxterms` or loosening `tolerances`.
              Alternatively, the callable may not be unimodal, or the limits of
              summation may be too far from the function maximum. Consider
              increasing `maxterms` or breaking the sum into pieces.

        sum : float array
            An estimate of the sum.
        error : float array
            An estimate of the absolute error, assuming all terms are non-negative,
            the function is computed exactly, and direct summation is accurate to
            the precision of the result dtype.
        nfev : int array
            The number of points at which `f` was evaluated.

    See Also
    --------
    mpmath.nsum

    Notes
    -----
    The method implemented for infinite summation is related to the integral
    test for convergence of an infinite series: assuming `step` size 1 for
    simplicity of exposition, the sum of a monotone decreasing function is bounded by

    .. math::

        \int_u^\infty f(x) dx \leq \sum_{k=u}^\infty f(k) \leq \int_u^\infty f(x) dx + f(u)

    Let :math:`a` represent  `a`, :math:`n` represent `maxterms`, :math:`\epsilon_a`
    represent `atol`, and :math:`\epsilon_r` represent `rtol`.
    The implementation first evaluates the integral :math:`S_l=\int_a^\infty f(x) dx`
    as a lower bound of the infinite sum. Then, it seeks a value :math:`c > a` such
    that :math:`f(c) < \epsilon_a + S_l \epsilon_r`, if it exists; otherwise,
    let :math:`c = a + n`. Then the infinite sum is approximated as

    .. math::

        \sum_{k=a}^{c-1} f(k) + \int_c^\infty f(x) dx + f(c)/2

    and the reported error is :math:`f(c)/2` plus the error estimate of
    numerical integration. Note that the integral approximations may require
    evaluation of the function at points besides those that appear in the sum,
    so `f` must be a continuous and monotonically decreasing function defined
    for all reals within the integration interval. However, due to the nature
    of the integral approximation, the shape of the function between points
    that appear in the sum has little effect. If there is not a natural
    extension of the function to all reals, consider using linear interpolation,
    which is easy to evaluate and preserves monotonicity.

    The approach described above is generalized for non-unit
    `step` and finite `b` that is too large for direct evaluation of the sum,
    i.e. ``b - a + 1 > maxterms``. It is further generalized to unimodal
    functions by directly summing terms surrounding the maximum.
    This strategy may fail:

    - If the left limit is finite and the maximum is far from it.
    - If the right limit is finite and the maximum is far from it.
    - If both limits are finite and the maximum is far from the origin.

    In these cases, accuracy may be poor, and `nsum` may return status code ``4``.

    Although the callable `f` must be non-negative and unimodal,
    `nsum` can be used to evaluate more general forms of series. For instance, to
    evaluate an alternating series, pass a callable that returns the difference
    between pairs of adjacent terms, and adjust `step` accordingly. See Examples.

    References
    ----------
    .. [1] Wikipedia. "Integral test for convergence."
           https://en.wikipedia.org/wiki/Integral_test_for_convergence

    Examples
    --------
    Compute the infinite sum of the reciprocals of squared integers.

    >>> import numpy as np
    >>> from scipy.integrate import nsum
    >>> res = nsum(lambda k: 1/k**2, 1, np.inf)
    >>> ref = np.pi**2/6  # true value
    >>> res.error  # estimated error
    np.float64(7.448762306416137e-09)
    >>> (res.sum - ref)/ref  # true error
    np.float64(-1.839871898894426e-13)
    >>> res.nfev  # number of points at which callable was evaluated
    np.int32(8561)

    Compute the infinite sums of the reciprocals of integers raised to powers ``p``,
    where ``p`` is an array.

    >>> from scipy import special
    >>> p = np.arange(3, 10)
    >>> res = nsum(lambda k, p: 1/k**p, 1, np.inf, maxterms=1e3, args=(p,))
    >>> ref = special.zeta(p, 1)
    >>> np.allclose(res.sum, ref)
    True

    Evaluate the alternating harmonic series.

    >>> res = nsum(lambda x: 1/x - 1/(x+1), 1, np.inf, step=2)
    >>> res.sum, res.sum - np.log(2)  # result, difference vs analytical sum
    (np.float64(0.6931471805598691), np.float64(-7.616129948928574e-14))

    F)r   r   r   r   r   N      ?r   r"   c                      g | ]
}|         S r   r   )r   r   i1s     rG   
<listcomp>znsum.<locals>.<listcomp>  s    ///3s2w///rI   c                      g | ]
}|         S r   r   )r   r   i2s     rG   r  znsum.<locals>.<listcomp>      111SR111rI   c                      g | ]
}|         S r   r   )r   r   i3s     rG   r  znsum.<locals>.<listcomp>  r  rI   c                      |  g|R  S r   r   )rS   r   r   s     rG   _fznsum.<locals>._f  s    A2-rI   c                      g | ]
}|         S r   r   )r   r   i4s     rG   r  znsum.<locals>.<listcomp>  r  rI   c                                          | dk    t          j        d          d          }                     | g|R   |  g|R  gd          }t	          j        |d          |z   S )Nr   r  rK   )r   rQ   r   rP   r   rO   )rS   r   
log_factoroutr   r   s       rG   r"  znsum.<locals>._f  sw    XXadDHSMM1==
hh!dQQr\D\\\:hCC(1555
BBrI   c                 h                         | dk    dd          } | g|R   |  g|R  z   |z  S )Nr   r  r   )r   )rS   r   factorr   r   s      rG   r"  znsum.<locals>._f  sJ    !Q$Q//!daalTlll2f<<rI   r   )r   r@   r.   successr-   )r  r_   r}   rc   r   r~   floorre   r   r(   rZ   r[   rQ   r   r   rX   r   r   onesrt   r]   _direct_integral_bound
zeros_likerb   r   )"r   r)   r*   r  r   r   r  r  tmpr  r   r   r   r   rN   r    ntermsfinite_termsr(   ri   	constantsSEr.   r-   i0args_directargs_indirectr"  r  r  r   r$  r   s"   `                            @@@@@rG   r
   r
     s   D 1aD$Xz
B
BCGJDAq!T<sHdD" /!aT4Eb
A
A
AC(+%Ar2tUE2 	1A
		(2??1e4455u==A99XboodE::;;UCCDBOOL%@@AALXXq1un%%F;;v&&Lo|(<T,=O(OOAlO ((5//
C::+rvgg!5:99"=D|$'5s48C==  S#XS$dH=I 	aA
aAXXc!ffBHX--F773q667**D B
1*
 RC	'B	Q2#		#B	Q2#		#rc	)B
sbSB3	B	vvbzz vrv"qur
	vvbzz J////$///a2"tBxiLL3B3x"quRCG"**bkk!B%&8&8%8*IIIr
	vvbzz 1111D111a2"tBx+Y< <#&ss8 "qufRjRCG	vvbzz 1111D111-----b1R5&1R5&$r(+Y< <#&ss8 "qufRjRCG	vvbzz 1111D111  		=C C C C C C C= = = = = = }}QrU##b$"tBx	SUVV#&ss8 "qufRjRAc"gI 99UB5!1!1"!5qA>>%((,dll5.A.A".EDF1Affk " " " "rI   Tc                    |\  }}	}
}}}}t          |          }                    ||z
  |z            |z   }t                              |                    }|d d j        f         |d d j        f         |d d j        f         }}}fd|D             }|                    ||          |z  z   }||||z  dz  z   k    }j        ||<    | |g|R  }|||<   ||                    d          z
  }|	rt          j        |d          n                    |d          }|	r$t          |          t          j        |
          z   n|
t          |          z  }|||fS )Nc                 2    g | ]}|d d j         f         S r   rp   r   s     rG   r  z_direct.<locals>.<listcomp>  s(    000CSBJ000rI   r   r   r"   rK   )r  roundr   rp   r   r]   r   r   rO   r   rQ   r   r   )r   r)   r*   r  r   r3  r   rB   r    r   r(   ri   _inclusive_adjustmentsteps	max_stepsa2b2step2args2ksi_nanr   r-   r4  r5  s         `                   rG   r-  r-    s    &/"E3T1a y>>HHa!et^$$';;EBFF5MM""I aaam$a2:&6QQQ
]8KEB00004000E	bii	i//%7	7B2,U21445EBuI	
2B
 BuIuyyby)))D*-F"2&&&&266"263F3FA&);

TXc]]""sSVV|Aa:rI   c           
        , |\  }}}	}	}
}}                     t          j        d          |          }t          | |||||
|          }                                         |          |j        j                  }|r4t          j        	                    ||
|j        z   f          d          }n||
|j        z  z   }|j
        dk     }j        ||<   |j
        }|dj        f         }|dj        f         }fd|D             }|r&t          j        t          j        |                    nd}                    d                    d|          z                       |g          f          }                    ||          }t%          |          dz  }|||z  z   } | |g|R  } | ||z   g|R  }||d d j        f         k    ||k    z  }                    |d          }                    |                     |j        d         d	z
                      }||         }||dz  k    }|||z  z   }t+          | |||||d
          \  } }!}"                    |           | dk    z  }#||#z  }d||#<   j        ||<   t          | |||||
|          }$|                    t%          |                    |f         }%|r                    |%j                   n                    |%          }&                    |          ,                    ,          r | |,         g,fd|D             R  |&,<   |                     ,|"j                  z   }|r                    |          }'| |$j        |'z
  |%|z
  |&|z
  f}(t          j        	                    |(          d          })|!|$j        |'z
  |%|z
  |&|z
  j        dz  z   f}*t?          t          j        	                    |*          d                    }+n2| |$j        |z  z   |%dz  z   |&dz  z   })|!|$j        |z  z   |%dz  z   |&dz  z
  }+|$j
        |          || <   d||dk    |z  <   |)|+||"|$j         z   |z   |j         z   fS )Nr   r   )r   r   r   r   r   rK   .c                 .    g | ]}|d j         f         S ).r;  r   s     rG   r  z#_integral_bound.<locals>.<listcomp>*  s$    222cSbj!222rI   r"   r   F)rB   r  c                      g | ]
}|         S r   r   )r   r   rh   s     rG   r  z#_integral_bound.<locals>.<listcomp>Y  s    111S#a&111rI   rs   )!rZ   rQ   r   r   r~   r?   rN   r   rO   rP   r.   r]   rp   r+  log2ro   r   rc   r   r   minimumr-  rd   r   r[   r/  re   rt   r    r@   r'   r   r-   )-r   r)   r*   r  r   r3  r   r    r   r=  r   r   r  rK  lbtoli_skipr.   rA  rC  rD  log2maxtermsn_stepsr-   rE  fksfksp1fk_insufficientn_fk_insufficientnti_fk_insufficientr   left
left_error	left_nfevleft_is_pos_infrightfkfblog_stepS_termsr4  E_termsr5  rh   s-         `                                     @rG   r.  r.    s   -6*E31dD(::dhqkk://D 
!Q4d	D	D	DB
//"**T**BK,=
>
>C
 %#tbk/A)B C C!LLLD$$Y]F&CKYF
 
3
?	Bbj!E2222T222E 7?E4:di11222ALiiBIIa666

H:8N8NOPPGii''Gw<<!D	go	B
!B----CAb5j!5!!!ESBJ//ECK@OR88	%rzz'-2CA2E'F'F	G	GBbkG +dAg5 	
GdNA")!Q4*3R5#J #J #JD*ihhtnnq1O
oF F?AfI Q14d3GGGE 
RYYs3xx  "$	%B '*	@b26'	"	"	"r}}R/@/@B
AA	vvayy 3!A$21111D1112221"**Qio*666D
 866$<<(2BIrDyIbhhw//a888u{X5r$w4b@PQG%bhhw&7&7a@@@AA5>$&&A-14T))BqD02a47lF7+FF7O02FFaK,,-aUZ/$6@@@rI   )T)"rQ   numpyr{   scipyr   (scipy._lib._elementwise_iterative_method_lib_elementwise_iterative_methodr_   scipy._lib._utilr   scipy._lib._array_apir   r   r   r   r	   __all__r   r   r   r   r   rD   rE   rM   ra   r   rz   r  r  r
   r-  r.  r   rI   rG   <module>rj     s              6 6 6 6 6 6 6 6 6 ( ( ( ( ( (@ @ @ @ @ @ @ @ @ @ @ @ @ @ (& !edQT%$R R R R Rj+ + +, ! ! !H  0M M M$  ,U U UpQ Q Qh1 1 16K< K< K<\9P 9P 9Px "%##e**QU a" a" a" a" a"H	- - - -`SA SA SA SA SArI   