
    Kh>?             	       	   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKr	SSK
Jr  SSK
Jr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:  SSK
J;r;  SSK
J<r<  SSK
J=r=  SS	K;J>r>J?r?  SS
K<J@r@JArAJBrBJCrCJDrD  SSK
Jr  SSKEJFrF  SSKGJHrH  \ArI\J" \B5      rKSrL\ R                  " \;R                  SS9rN/ SQrO SUSS.S jjrP\N" \P5       SVSS.S jj5       rQ\>\?" S5      SWSSS.S jj5       5       rR\N" 5       " \R5      rS SUSS.S jjrT\N" \T5       SVSS.S jj5       rU SXSSS.S jjrV\>\?" S5      SWSSS.S jj5       5       rW\N" 5       " \W5      rX SUSS.S jjrY\N" \Y5       SVSS.S jj5       rZSYSS.S jjr[\N" \[5      SYSS.S  jj5       r\\?" S5      S! 5       r]S" r^\N" \^5      S# 5       r_S$ r`\N" \`5      S% 5       raSYS& jrb\N" \b5      SZS' j5       rcSYS( jrd\N" \d5      S[S) j5       reSYS* jrf\N" \f5      SYS+ j5       rgSYS, jrh\N" \h5      S\S- j5       riSYS. jrj\N" \j5      SYS/ j5       rkSYS0 jrl\N" \l5      S]S1 j5       rm\?" S25      S^S3 j5       rnS4 ro\N" \o5      S5 5       rpSUS6 jrq\N" \q5      S_S7 j5       rr\R                  S8:H  rt\?" S5      \uS4S9 j5       rv\>\?" S5      \wSS:.S; j5       5       rx\N" 5       " \x5      ryS< rz\?" S5      S= 5       r{\?" S5      SYS> j5       r|\?" S5      S`S? j5       r}S@ r~\>\?" S5      SYSSA.SB jj5       5       r\N" 5       " \5      rSaSC jr\N" \5      SbSD j5       rSaSE jr\N" \5      SbSF j5       rSYSG jr\J" \!" \GR                  5      5      \J" \!" \GR                  5      5      \J" \!" \GR                  5      5      \J" \!" \GR                  5      5      \J" \!" \GR                  5      5      1rSH r\N" \5      ScSI j5       rSJ r\N" \5      SK 5       rSSSL.SM jr\N" \5      SSSL.SN j5       r\Cr\Dr\GR                  " S5      r\GR                  " S5      rSO rSSPK<7  SSPK7  SSQK
Jr  SSPK7  SSRK
Jr  SSPK7  SSSK
Jr  SSPK7  SSTK
JGrG  SSPKG7  \" \5        \" \<5        \" \5        \" \5        \" \5        \" \G5        g)d    N   )
multiarray)numerictypes)-ALLOW_THREADSBUFSIZECLIPMAXDIMSMAY_SHARE_BOUNDSMAY_SHARE_EXACTRAISEWRAParangearrayasarray
asanyarrayascontiguousarrayasfortranarray	broadcastcan_castconcatenatecopytodotdtypeempty
empty_likeflatiter
frombufferfrom_dlpackfromfilefromiter
fromstringinnerlexsortmatmulmay_share_memorymin_scalar_typendarraynditernested_iterspromote_typesputmaskresult_typeshares_memoryvdotwherezerosnormalize_axis_indexvecdot)	overrides)umath)
shape_base)finalize_array_function_like
set_module)multiplyinvertsinPINFNAN   )	AxisError)errstatenumpy)module)Hnewaxisr'   r   r(   r)   ufuncr   r   r   r   r   r   r0   count_nonzeror   r   r   r!   r   r   r   r/   argwherer   r   r#   astyper   r*   r&   r,   	isfortranr   
zeros_like	ones_like	correlateconvolver"   r   outerr.   rollrollaxismoveaxiscross	tensordotlittle_endianr    array_equalarray_equivindicesfromfunctioniscloseisscalarbinary_repr	base_repronesidentityallcloser+   flatnonzeroinfnanFalse_True_bitwise_notfull	full_liker$   r2   r-   r%   devicec                    U 4$ N ar   ordersubokshaperg   s         E/var/www/html/env/lib/python3.13/site-packages/numpy/_core/numeric.py_zeros_like_dispatcherrq   :        4K    Tc          	      n    [        XX#XES9n[        SUR                  S9n[        R                  " XgSS9  U$ )a  
Return an array of zeros with the same shape and type as a given array.

Parameters
----------
a : array_like
    The shape and data-type of `a` define these same attributes of
    the returned array.
dtype : data-type, optional
    Overrides the data type of the result.
order : {'C', 'F', 'A', or 'K'}, optional
    Overrides the memory layout of the result. 'C' means C-order,
    'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous,
    'C' otherwise. 'K' means match the layout of `a` as closely
    as possible.
subok : bool, optional.
    If True, then the newly created array will use the sub-class
    type of `a`, otherwise it will be a base-class array. Defaults
    to True.
shape : int or sequence of ints, optional.
    Overrides the shape of the result. If order='K' and the number of
    dimensions is unchanged, will try to keep order, otherwise,
    order='C' is implied.
device : str, optional
    The device on which to place the created array. Default: None.
    For Array-API interoperability only, so must be ``"cpu"`` if passed.

    .. versionadded:: 2.0.0

Returns
-------
out : ndarray
    Array of zeros with the same shape and type as `a`.

See Also
--------
empty_like : Return an empty array with shape and type of input.
ones_like : Return an array of ones with shape and type of input.
full_like : Return a new array with shape of input filled with value.
zeros : Return a new array setting values to zero.

Examples
--------
>>> import numpy as np
>>> x = np.arange(6)
>>> x = x.reshape((2, 3))
>>> x
array([[0, 1, 2],
       [3, 4, 5]])
>>> np.zeros_like(x)
array([[0, 0, 0],
       [0, 0, 0]])

>>> y = np.arange(3, dtype=float)
>>> y
array([0., 1., 2.])
>>> np.zeros_like(y)
array([0.,  0.,  0.])

r   rm   rn   ro   rg   r   r   unsafecasting)r   r0   r   r   r   )rl   r   rm   rn   ro   rg   reszs           rp   rH   rH   @   s=    @ 	eC 	asyy!Ach/Jrs   )rg   likec                b    Ub  [        X@XUS9$ [        XX#S9n[        R                  " USSS9  U$ )a  
Return a new array of given shape and type, filled with ones.

Parameters
----------
shape : int or sequence of ints
    Shape of the new array, e.g., ``(2, 3)`` or ``2``.
dtype : data-type, optional
    The desired data-type for the array, e.g., `numpy.int8`.  Default is
    `numpy.float64`.
order : {'C', 'F'}, optional, default: C
    Whether to store multi-dimensional data in row-major
    (C-style) or column-major (Fortran-style) order in
    memory.
device : str, optional
    The device on which to place the created array. Default: None.
    For Array-API interoperability only, so must be ``"cpu"`` if passed.

    .. versionadded:: 2.0.0
${ARRAY_FUNCTION_LIKE}

    .. versionadded:: 1.20.0

Returns
-------
out : ndarray
    Array of ones with the given shape, dtype, and order.

See Also
--------
ones_like : Return an array of ones with shape and type of input.
empty : Return a new uninitialized array.
zeros : Return a new array setting values to zero.
full : Return a new array of given shape filled with value.

Examples
--------
>>> import numpy as np
>>> np.ones(5)
array([1., 1., 1., 1., 1.])

>>> np.ones((5,), dtype=int)
array([1, 1, 1, 1, 1])

>>> np.ones((2, 1))
array([[1.],
       [1.]])

>>> s = (2,2)
>>> np.ones(s)
array([[1.,  1.],
       [1.,  1.]])

r   rm   rg   rf   r   rw   rx   )_ones_with_liker   r   r   )ro   r   rm   rg   r|   rl   s         rp   r[   r[      sD    r u&
 	
 	eE1AaH-Hrs   c                    U 4$ ri   rj   rk   s         rp   _ones_like_dispatcherr      rr   rs   c          	      H    [        XX#XES9n[        R                  " USSS9  U$ )a  
Return an array of ones with the same shape and type as a given array.

Parameters
----------
a : array_like
    The shape and data-type of `a` define these same attributes of
    the returned array.
dtype : data-type, optional
    Overrides the data type of the result.
order : {'C', 'F', 'A', or 'K'}, optional
    Overrides the memory layout of the result. 'C' means C-order,
    'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous,
    'C' otherwise. 'K' means match the layout of `a` as closely
    as possible.
subok : bool, optional.
    If True, then the newly created array will use the sub-class
    type of `a`, otherwise it will be a base-class array. Defaults
    to True.
shape : int or sequence of ints, optional.
    Overrides the shape of the result. If order='K' and the number of
    dimensions is unchanged, will try to keep order, otherwise,
    order='C' is implied.
device : str, optional
    The device on which to place the created array. Default: None.
    For Array-API interoperability only, so must be ``"cpu"`` if passed.

    .. versionadded:: 2.0.0

Returns
-------
out : ndarray
    Array of ones with the same shape and type as `a`.

See Also
--------
empty_like : Return an empty array with shape and type of input.
zeros_like : Return an array of zeros with shape and type of input.
full_like : Return a new array with shape of input filled with value.
ones : Return a new array setting values to one.

Examples
--------
>>> import numpy as np
>>> x = np.arange(6)
>>> x = x.reshape((2, 3))
>>> x
array([[0, 1, 2],
       [3, 4, 5]])
>>> np.ones_like(x)
array([[1, 1, 1],
       [1, 1, 1]])

>>> y = np.arange(3, dtype=float)
>>> y
array([0., 1., 2.])
>>> np.ones_like(y)
array([1.,  1.,  1.])

ru   r   rw   rx   r   r   r   )rl   r   rm   rn   ro   rg   rz   s          rp   rI   rI      s/    @ 	eC c1h/Jrs   c                    U4$ ri   rj   )ro   
fill_valuer   rm   rg   r|   s         rp   _full_dispatcherr     s     'Mrs   c          	          Ub  [        XPXX4S9$ Uc  [        U5      nUR                  n[        XX4S9n[        R
                  " XaSS9  U$ )a  
Return a new array of given shape and type, filled with `fill_value`.

Parameters
----------
shape : int or sequence of ints
    Shape of the new array, e.g., ``(2, 3)`` or ``2``.
fill_value : scalar or array_like
    Fill value.
dtype : data-type, optional
    The desired data-type for the array  The default, None, means
     ``np.array(fill_value).dtype``.
order : {'C', 'F'}, optional
    Whether to store multidimensional data in C- or Fortran-contiguous
    (row- or column-wise) order in memory.
device : str, optional
    The device on which to place the created array. Default: None.
    For Array-API interoperability only, so must be ``"cpu"`` if passed.

    .. versionadded:: 2.0.0
${ARRAY_FUNCTION_LIKE}

    .. versionadded:: 1.20.0

Returns
-------
out : ndarray
    Array of `fill_value` with the given shape, dtype, and order.

See Also
--------
full_like : Return a new array with shape of input filled with value.
empty : Return a new uninitialized array.
ones : Return a new array setting values to one.
zeros : Return a new array setting values to zero.

Examples
--------
>>> import numpy as np
>>> np.full((2, 2), np.inf)
array([[inf, inf],
       [inf, inf]])
>>> np.full((2, 2), 10)
array([[10, 10],
       [10, 10]])

>>> np.full((2, 2), [1, 2])
array([[1, 2],
       [1, 2]])

r~   rf   rw   rx   )_full_with_liker   r   r   r   r   )ro   r   r   rm   rg   r|   rl   s          rp   rd   rd   "  s\    l 
 	
 }Z(
  eE1AaX6Hrs   c                    U 4$ ri   rj   )rl   r   r   rm   rn   ro   rg   s          rp   _full_like_dispatcherr   h  s     4Krs   c          	      F    [        XX4XVS9n[        R                  " XqSS9  U$ )aC  
Return a full array with the same shape and type as a given array.

Parameters
----------
a : array_like
    The shape and data-type of `a` define these same attributes of
    the returned array.
fill_value : array_like
    Fill value.
dtype : data-type, optional
    Overrides the data type of the result.
order : {'C', 'F', 'A', or 'K'}, optional
    Overrides the memory layout of the result. 'C' means C-order,
    'F' means F-order, 'A' means 'F' if `a` is Fortran contiguous,
    'C' otherwise. 'K' means match the layout of `a` as closely
    as possible.
subok : bool, optional.
    If True, then the newly created array will use the sub-class
    type of `a`, otherwise it will be a base-class array. Defaults
    to True.
shape : int or sequence of ints, optional.
    Overrides the shape of the result. If order='K' and the number of
    dimensions is unchanged, will try to keep order, otherwise,
    order='C' is implied.
device : str, optional
    The device on which to place the created array. Default: None.
    For Array-API interoperability only, so must be ``"cpu"`` if passed.

    .. versionadded:: 2.0.0

Returns
-------
out : ndarray
    Array of `fill_value` with the same shape and type as `a`.

See Also
--------
empty_like : Return an empty array with shape and type of input.
ones_like : Return an array of ones with shape and type of input.
zeros_like : Return an array of zeros with shape and type of input.
full : Return a new array of given shape filled with value.

Examples
--------
>>> import numpy as np
>>> x = np.arange(6, dtype=int)
>>> np.full_like(x, 1)
array([1, 1, 1, 1, 1, 1])
>>> np.full_like(x, 0.1)
array([0, 0, 0, 0, 0, 0])
>>> np.full_like(x, 0.1, dtype=np.double)
array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1])
>>> np.full_like(x, np.nan, dtype=np.double)
array([nan, nan, nan, nan, nan, nan])

>>> y = np.arange(6, dtype=np.double)
>>> np.full_like(y, 0.1)
array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1])

>>> y = np.zeros([2, 2, 3], dtype=int)
>>> np.full_like(y, [0, 0, 255])
array([[[  0,   0, 255],
        [  0,   0, 255]],
       [[  0,   0, 255],
        [  0,   0, 255]]])
ru   rw   rx   r   )rl   r   r   rm   rn   ro   rg   rz   s           rp   re   re   o  s-    P 	eC cx8Jrs   )keepdimsc                    U 4$ ri   rj   )rl   axisr   s      rp   _count_nonzero_dispatcherr     	    4Krs   Fc                t   Uc  U(       d  [         R                  " U 5      $ [        U 5      n [        R                  " U R
                  [        R                  5      (       a  X R
                  R                  5       :g  nOU R                  [        R                  SS9nUR                  U[        R                  US9$ )ar  
Counts the number of non-zero values in the array ``a``.

The word "non-zero" is in reference to the Python 2.x
built-in method ``__nonzero__()`` (renamed ``__bool__()``
in Python 3.x) of Python objects that tests an object's
"truthfulness". For example, any number is considered
truthful if it is nonzero, whereas any string is considered
truthful if it is not the empty string. Thus, this function
(recursively) counts how many elements in ``a`` (and in
sub-arrays thereof) have their ``__nonzero__()`` or ``__bool__()``
method evaluated to ``True``.

Parameters
----------
a : array_like
    The array for which to count non-zeros.
axis : int or tuple, optional
    Axis or tuple of axes along which to count non-zeros.
    Default is None, meaning that non-zeros will be counted
    along a flattened version of ``a``.
keepdims : bool, optional
    If this is set to True, the axes that are counted are left
    in the result as dimensions with size one. With this option,
    the result will broadcast correctly against the input array.

Returns
-------
count : int or array of int
    Number of non-zero values in the array along a given axis.
    Otherwise, the total number of non-zero values in the array
    is returned.

See Also
--------
nonzero : Return the coordinates of all the non-zero values.

Examples
--------
>>> import numpy as np
>>> np.count_nonzero(np.eye(4))
4
>>> a = np.array([[0, 1, 7, 0],
...               [3, 0, 2, 19]])
>>> np.count_nonzero(a)
5
>>> np.count_nonzero(a, axis=0)
array([1, 1, 2, 1])
>>> np.count_nonzero(a, axis=1)
array([2, 3])
>>> np.count_nonzero(a, axis=1, keepdims=True)
array([[2],
       [3]])
Fcopy)r   r   r   )r   rD   r   np
issubdtyper   	charactertyperF   boolsumintp)rl   r   r   a_bools       rp   rD   rD     s    p |H''**1A 
}}QWWbll++gglln$"''.::4rww:BBrs   c                 .    U R                   R                  $ )a  
Check if the array is Fortran contiguous but *not* C contiguous.

This function is obsolete. If you only want to check if an array is Fortran
contiguous use ``a.flags.f_contiguous`` instead.

Parameters
----------
a : ndarray
    Input array.

Returns
-------
isfortran : bool
    Returns True if the array is Fortran contiguous but *not* C contiguous.


Examples
--------

np.array allows to specify whether the array is written in C-contiguous
order (last index varies the fastest), or FORTRAN-contiguous order in
memory (first index varies the fastest).

>>> import numpy as np
>>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C')
>>> a
array([[1, 2, 3],
       [4, 5, 6]])
>>> np.isfortran(a)
False

>>> b = np.array([[1, 2, 3], [4, 5, 6]], order='F')
>>> b
array([[1, 2, 3],
       [4, 5, 6]])
>>> np.isfortran(b)
True


The transpose of a C-ordered array is a FORTRAN-ordered array.

>>> a = np.array([[1, 2, 3], [4, 5, 6]], order='C')
>>> a
array([[1, 2, 3],
       [4, 5, 6]])
>>> np.isfortran(a)
False
>>> b = a.T
>>> b
array([[1, 4],
       [2, 5],
       [3, 6]])
>>> np.isfortran(b)
True

C-ordered arrays evaluate as False even if they are also FORTRAN-ordered.

>>> np.isfortran(np.array([1, 2], order='F'))
False

)flagsfncrl   s    rp   rG   rG     s    @ 77;;rs   c                     U 4$ ri   rj   r   s    rp   _argwhere_dispatcherr   K  r   rs   c                     [         R                  " U 5      S:X  a*  [        R                  " U 5      n [	        U 5      SS2SS24   $ [        [        U 5      5      $ )aK  
Find the indices of array elements that are non-zero, grouped by element.

Parameters
----------
a : array_like
    Input data.

Returns
-------
index_array : (N, a.ndim) ndarray
    Indices of elements that are non-zero. Indices are grouped by element.
    This array will have shape ``(N, a.ndim)`` where ``N`` is the number of
    non-zero items.

See Also
--------
where, nonzero

Notes
-----
``np.argwhere(a)`` is almost the same as ``np.transpose(np.nonzero(a))``,
but produces a result of the correct shape for a 0D array.

The output of ``argwhere`` is not suitable for indexing arrays.
For this purpose use ``nonzero(a)`` instead.

Examples
--------
>>> import numpy as np
>>> x = np.arange(6).reshape(2,3)
>>> x
array([[0, 1, 2],
       [3, 4, 5]])
>>> np.argwhere(x>1)
array([[0, 2],
       [1, 0],
       [1, 1],
       [1, 2]])

r   N)r   ndimr5   
atleast_1drE   	transposenonzeror   s    rp   rE   rE   O  sJ    X 
wwqzQ!!!${1bqb5!!WQZ  rs   c                     U 4$ ri   rj   r   s    rp   _flatnonzero_dispatcherr     r   rs   c                 \    [         R                  " [         R                  " U 5      5      S   $ )a  
Return indices that are non-zero in the flattened version of a.

This is equivalent to ``np.nonzero(np.ravel(a))[0]``.

Parameters
----------
a : array_like
    Input data.

Returns
-------
res : ndarray
    Output array, containing the indices of the elements of ``a.ravel()``
    that are non-zero.

See Also
--------
nonzero : Return the indices of the non-zero elements of the input array.
ravel : Return a 1-D array containing the elements of the input array.

Examples
--------
>>> import numpy as np
>>> x = np.arange(-2, 3)
>>> x
array([-2, -1,  0,  1,  2])
>>> np.flatnonzero(x)
array([0, 1, 3, 4])

Use the indices of the non-zero elements as an index array to extract
these elements:

>>> x.ravel()[np.flatnonzero(x)]
array([-2, -1,  1,  2])

r   )r   r   ravelr   s    rp   r^   r^     s!    N ::bhhqk"1%%rs   c                     X4$ ri   rj   rl   vmodes      rp   _correlate_dispatcherr     	    6Mrs   c                 0    [         R                  " XU5      $ )a  
Cross-correlation of two 1-dimensional sequences.

This function computes the correlation as generally defined in signal
processing texts [1]_:

.. math:: c_k = \sum_n a_{n+k} \cdot \overline{v}_n

with a and v sequences being zero-padded where necessary and
:math:`\overline v` denoting complex conjugation.

Parameters
----------
a, v : array_like
    Input sequences.
mode : {'valid', 'same', 'full'}, optional
    Refer to the `convolve` docstring.  Note that the default
    is 'valid', unlike `convolve`, which uses 'full'.

Returns
-------
out : ndarray
    Discrete cross-correlation of `a` and `v`.

See Also
--------
convolve : Discrete, linear convolution of two one-dimensional sequences.
scipy.signal.correlate : uses FFT which has superior performance
    on large arrays.

Notes
-----
The definition of correlation above is not unique and sometimes
correlation may be defined differently. Another common definition is [1]_:

.. math:: c'_k = \sum_n a_{n} \cdot \overline{v_{n+k}}

which is related to :math:`c_k` by :math:`c'_k = c_{-k}`.

`numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5)
because it does not use the FFT to compute the convolution; in that case,
`scipy.signal.correlate` might be preferable.

References
----------
.. [1] Wikipedia, "Cross-correlation",
       https://en.wikipedia.org/wiki/Cross-correlation

Examples
--------
>>> import numpy as np
>>> np.correlate([1, 2, 3], [0, 1, 0.5])
array([3.5])
>>> np.correlate([1, 2, 3], [0, 1, 0.5], "same")
array([2. ,  3.5,  3. ])
>>> np.correlate([1, 2, 3], [0, 1, 0.5], "full")
array([0.5,  2. ,  3.5,  3. ,  0. ])

Using complex sequences:

>>> np.correlate([1+1j, 2, 3-1j], [0, 1, 0.5j], 'full')
array([ 0.5-0.5j,  1.0+0.j ,  1.5-1.5j,  3.0-1.j ,  0.0+0.j ])

Note that you get the time reversed, complex conjugated result
(:math:`\overline{c_{-k}}`) when the two input sequences a and v change
places:

>>> np.correlate([0, 1, 0.5j], [1+1j, 2, 3-1j], 'full')
array([ 0.0+0.j ,  3.0+1.j ,  1.5+1.5j,  1.0+0.j ,  0.5+0.5j])

)r   
correlate2r   s      rp   rJ   rJ     s    R   t,,rs   c                     X4$ ri   rj   r   s      rp   _convolve_dispatcherr      r   rs   c                    [        U SSS9[        USSS9p[        U5      [        U 5      :  a  Xp[        U 5      S:X  a  [        S5      e[        U5      S:X  a  [        S5      e[        R                  " XSSS2   U5      $ )a  
Returns the discrete, linear convolution of two one-dimensional sequences.

The convolution operator is often seen in signal processing, where it
models the effect of a linear time-invariant system on a signal [1]_.  In
probability theory, the sum of two independent random variables is
distributed according to the convolution of their individual
distributions.

If `v` is longer than `a`, the arrays are swapped before computation.

Parameters
----------
a : (N,) array_like
    First one-dimensional input array.
v : (M,) array_like
    Second one-dimensional input array.
mode : {'full', 'valid', 'same'}, optional
    'full':
      By default, mode is 'full'.  This returns the convolution
      at each point of overlap, with an output shape of (N+M-1,). At
      the end-points of the convolution, the signals do not overlap
      completely, and boundary effects may be seen.

    'same':
      Mode 'same' returns output of length ``max(M, N)``.  Boundary
      effects are still visible.

    'valid':
      Mode 'valid' returns output of length
      ``max(M, N) - min(M, N) + 1``.  The convolution product is only given
      for points where the signals overlap completely.  Values outside
      the signal boundary have no effect.

Returns
-------
out : ndarray
    Discrete, linear convolution of `a` and `v`.

See Also
--------
scipy.signal.fftconvolve : Convolve two arrays using the Fast Fourier
                           Transform.
scipy.linalg.toeplitz : Used to construct the convolution operator.
polymul : Polynomial multiplication. Same output as convolve, but also
          accepts poly1d objects as input.

Notes
-----
The discrete convolution operation is defined as

.. math:: (a * v)_n = \sum_{m = -\infty}^{\infty} a_m v_{n - m}

It can be shown that a convolution :math:`x(t) * y(t)` in time/space
is equivalent to the multiplication :math:`X(f) Y(f)` in the Fourier
domain, after appropriate padding (padding is necessary to prevent
circular convolution).  Since multiplication is more efficient (faster)
than convolution, the function `scipy.signal.fftconvolve` exploits the
FFT to calculate the convolution of large data-sets.

References
----------
.. [1] Wikipedia, "Convolution",
    https://en.wikipedia.org/wiki/Convolution

Examples
--------
Note how the convolution operator flips the second array
before "sliding" the two across one another:

>>> import numpy as np
>>> np.convolve([1, 2, 3], [0, 1, 0.5])
array([0. , 1. , 2.5, 4. , 1.5])

Only return the middle values of the convolution.
Contains boundary effects, where zeros are taken
into account:

>>> np.convolve([1,2,3],[0,1,0.5], 'same')
array([1. ,  2.5,  4. ])

The two arrays are of the same length, so there
is only one position where they completely overlap:

>>> np.convolve([1,2,3],[0,1,0.5], 'valid')
array([2.5])

Nr   )r   ndminr   za cannot be emptyzv cannot be empty)r   len
ValueErrorr   rJ   r   s      rp   rK   rK     s{    t Q'qt1)EqAQ1
1v{,--
1v{,--TrT7D11rs   c                 
    XU4$ ri   rj   rl   bouts      rp   _outer_dispatcherr   h  s    #;rs   c                     [        U 5      n [        U5      n[        U R                  5       SS2[        4   UR                  5       [        SS24   U5      $ )a	  
Compute the outer product of two vectors.

Given two vectors `a` and `b` of length ``M`` and ``N``, respectively,
the outer product [1]_ is::

  [[a_0*b_0  a_0*b_1 ... a_0*b_{N-1} ]
   [a_1*b_0    .
   [ ...          .
   [a_{M-1}*b_0            a_{M-1}*b_{N-1} ]]

Parameters
----------
a : (M,) array_like
    First input vector.  Input is flattened if
    not already 1-dimensional.
b : (N,) array_like
    Second input vector.  Input is flattened if
    not already 1-dimensional.
out : (M, N) ndarray, optional
    A location where the result is stored

Returns
-------
out : (M, N) ndarray
    ``out[i, j] = a[i] * b[j]``

See also
--------
inner
einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent.
ufunc.outer : A generalization to dimensions other than 1D and other
              operations. ``np.multiply.outer(a.ravel(), b.ravel())``
              is the equivalent.
linalg.outer : An Array API compatible variation of ``np.outer``,
               which accepts 1-dimensional inputs only.
tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))``
            is the equivalent.

References
----------
.. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, 3rd
       ed., Baltimore, MD, Johns Hopkins University Press, 1996,
       pg. 8.

Examples
--------
Make a (*very* coarse) grid for computing a Mandelbrot set:

>>> import numpy as np
>>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5))
>>> rl
array([[-2., -1.,  0.,  1.,  2.],
       [-2., -1.,  0.,  1.,  2.],
       [-2., -1.,  0.,  1.,  2.],
       [-2., -1.,  0.,  1.,  2.],
       [-2., -1.,  0.,  1.,  2.]])
>>> im = np.outer(1j*np.linspace(2, -2, 5), np.ones((5,)))
>>> im
array([[0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j, 0.+2.j],
       [0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j, 0.+1.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j, 0.-1.j],
       [0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j, 0.-2.j]])
>>> grid = rl + im
>>> grid
array([[-2.+2.j, -1.+2.j,  0.+2.j,  1.+2.j,  2.+2.j],
       [-2.+1.j, -1.+1.j,  0.+1.j,  1.+1.j,  2.+1.j],
       [-2.+0.j, -1.+0.j,  0.+0.j,  1.+0.j,  2.+0.j],
       [-2.-1.j, -1.-1.j,  0.-1.j,  1.-1.j,  2.-1.j],
       [-2.-2.j, -1.-2.j,  0.-2.j,  1.-2.j,  2.-2.j]])

An example using a "vector" of letters:

>>> x = np.array(['a', 'b', 'c'], dtype=object)
>>> np.outer(x, [1, 2, 3])
array([['a', 'aa', 'aaa'],
       ['b', 'bb', 'bbb'],
       ['c', 'cc', 'ccc']], dtype=object)

N)r   r8   r   rB   r   s      rp   rL   rL   l  sD    f 	
A
AAGGIaj)1779WaZ+@#FFrs   c                     X4$ ri   rj   )rl   r   axess      rp   _tensordot_dispatcherr     r   rs   c                   ^^  [        U5        Uu  p4 [	        U5      n[        U5      n [	        U5      n[        U5      n[        U 5      [        U5      pU R                  mU R                  nUR                  mUR                  nSn	XV:w  a  Sn	OP[        U5       HA  n
TX:      TXJ      :w  a  Sn	  O.X:   S:  a  X:==   U-  ss'   XJ   S:  d  M5  XJ==   U-  ss'   MC     U	(       d  [        S5      e[        U5       V
s/ s H  oU;  d  M
  U
PM     nn
X-   n[        R                  " U4S jU 5       5      n[        R                  " U Vs/ s H  nTU   PM
     sn5      U4nU Vs/ s H  nTU   PM
     nn[        U5       V
s/ s H  oU;  d  M
  U
PM     nn
XK-   n[        R                  " U4S jU 5       5      nU[        R                  " U Vs/ s H  nTU   PM
     sn5      4nU Vs/ s H  nTU   PM
     nnU R                  U5      R                  U5      nUR                  U5      R                  U5      n[        UU5      nUR                  UU-   5      $ ! [         a/    [        [        U* S5      5      n[        [        SU5      5      n GNf = f! [
         a	    U/nSn GNf = f! [
         a	    U/nSn GNf = fs  sn
f s  snf s  snf s  sn
f s  snf s  snf )aL  
Compute tensor dot product along specified axes.

Given two tensors, `a` and `b`, and an array_like object containing
two array_like objects, ``(a_axes, b_axes)``, sum the products of
`a`'s and `b`'s elements (components) over the axes specified by
``a_axes`` and ``b_axes``. The third argument can be a single non-negative
integer_like scalar, ``N``; if it is such, then the last ``N`` dimensions
of `a` and the first ``N`` dimensions of `b` are summed over.

Parameters
----------
a, b : array_like
    Tensors to "dot".

axes : int or (2,) array_like
    * integer_like
      If an int N, sum over the last N axes of `a` and the first N axes
      of `b` in order. The sizes of the corresponding axes must match.
    * (2,) array_like
      Or, a list of axes to be summed over, first sequence applying to `a`,
      second to `b`. Both elements array_like must be of the same length.

Returns
-------
output : ndarray
    The tensor dot product of the input.

See Also
--------
dot, einsum

Notes
-----
Three common use cases are:
    * ``axes = 0`` : tensor product :math:`a\otimes b`
    * ``axes = 1`` : tensor dot product :math:`a\cdot b`
    * ``axes = 2`` : (default) tensor double contraction :math:`a:b`

When `axes` is integer_like, the sequence of axes for evaluation
will be: from the -Nth axis to the -1th axis in `a`,
and from the 0th axis to (N-1)th axis in `b`.
For example, ``axes = 2`` is the equal to
``axes = [[-2, -1], [0, 1]]``.
When N-1 is smaller than 0, or when -N is larger than -1,
the element of `a` and `b` are defined as the `axes`.

When there is more than one axis to sum over - and they are not the last
(first) axes of `a` (`b`) - the argument `axes` should consist of
two sequences of the same length, with the first axis to sum over given
first in both sequences, the second axis second, and so forth.
The calculation can be referred to ``numpy.einsum``.

The shape of the result consists of the non-contracted axes of the
first tensor, followed by the non-contracted axes of the second.

Examples
-------- 
An example on integer_like:

>>> a_0 = np.array([[1, 2], [3, 4]])
>>> b_0 = np.array([[5, 6], [7, 8]])
>>> c_0 = np.tensordot(a_0, b_0, axes=0)
>>> c_0.shape
(2, 2, 2, 2)
>>> c_0
array([[[[ 5,  6],
         [ 7,  8]],
        [[10, 12],
         [14, 16]]],
       [[[15, 18],
         [21, 24]],
        [[20, 24],
         [28, 32]]]])

An example on array_like:

>>> a = np.arange(60.).reshape(3,4,5)
>>> b = np.arange(24.).reshape(4,3,2)
>>> c = np.tensordot(a,b, axes=([1,0],[0,1]))
>>> c.shape
(5, 2)
>>> c
array([[4400., 4730.],
       [4532., 4874.],
       [4664., 5018.],
       [4796., 5162.],
       [4928., 5306.]])
       
A slower but equivalent way of computing the same...

>>> d = np.zeros((5,2))
>>> for i in range(5):
...   for j in range(2):
...     for k in range(3):
...       for n in range(4):
...         d[i,j] += a[k,n,i] * b[n,k,j]
>>> c == d
array([[ True,  True],
       [ True,  True],
       [ True,  True],
       [ True,  True],
       [ True,  True]])

An extended example taking advantage of the overloading of + and \*:

>>> a = np.array(range(1, 9))
>>> a.shape = (2, 2, 2)
>>> A = np.array(('a', 'b', 'c', 'd'), dtype=object)
>>> A.shape = (2, 2)
>>> a; A
array([[[1, 2],
        [3, 4]],
       [[5, 6],
        [7, 8]]])
array([['a', 'b'],
       ['c', 'd']], dtype=object)

>>> np.tensordot(a, A) # third argument default is 2 for double-contraction
array(['abbcccdddd', 'aaaaabbbbbbcccccccdddddddd'], dtype=object)

>>> np.tensordot(a, A, 1)
array([[['acc', 'bdd'],
        ['aaacccc', 'bbbdddd']],
       [['aaaaacccccc', 'bbbbbdddddd'],
        ['aaaaaaacccccccc', 'bbbbbbbdddddddd']]], dtype=object)

>>> np.tensordot(a, A, 0) # tensor product (result too long to incl.)
array([[[[['a', 'b'],
          ['c', 'd']],
          ...

>>> np.tensordot(a, A, (0, 1))
array([[['abbbbb', 'cddddd'],
        ['aabbbbbb', 'ccdddddd']],
       [['aaabbbbbbb', 'cccddddddd'],
        ['aaaabbbbbbbb', 'ccccdddddddd']]], dtype=object)

>>> np.tensordot(a, A, (2, 1))
array([[['abb', 'cdd'],
        ['aaabbbb', 'cccdddd']],
       [['aaaaabbbbbb', 'cccccdddddd'],
        ['aaaaaaabbbbbbbb', 'cccccccdddddddd']]], dtype=object)

>>> np.tensordot(a, A, ((0, 1), (0, 1)))
array(['abbbcccccddddddd', 'aabbbbccccccdddddddd'], dtype=object)

>>> np.tensordot(a, A, ((2, 1), (1, 0)))
array(['acccbbdddd', 'aaaaacccccccbbbbbbdddddddd'], dtype=object)

r   r   TFzshape-mismatch for sumc              3   .   >#    U  H
  nTU   v   M     g 7fri   rj   ).0r   as_s     rp   	<genexpr>tensordot.<locals>.<genexpr>  s     03t9   c              3   .   >#    U  H
  nTU   v   M     g 7fri   rj   )r   r   bss     rp   r   r     s     /2d8r   )iter	Exceptionlistranger   	TypeErrorr   ro   r   r   mathprodr   reshaper   )rl   r   r   axes_aaxes_bnanbndandbequalknotin	newaxes_aN2ax
newshape_ar   olda	newaxes_b
newshape_boldbatbtrz   r   r   s                           @@rp   rQ   rQ     s   rT

 [f[f
 1:wqzq
''C
&&C	
B
&&CE	xrA69~FI.y1}	S 	y1}	S 	  122 c
6
1voQ
E6I	00	0B))u5uSWu56;J"'(%$CI%D(c
6
1voQ
E6I	//	/Bdii% 8%BB% 89:J!&'BtHD'	
Y		'	'
	3B	
Y		'	'
	3B
b"+C;;td{##o  &eTE1o&eAtn%&    4 7 6(6 !9'sc   I  J J2 ?	KKK(K	KKK
/K! 5JJJ/.J/2KKc                     U 4$ ri   rj   )rl   shiftr   s      rp   _roll_dispatcherr     r   rs   c                 &   [        U 5      n Uc4  [        U R                  5       US5      R                  U R                  5      $ [        X R                  SS9n[        X5      nUR                  S:  a  [        S5      e[        U R                  5       Vs0 s H  oDS_M     nnU H  u  pdXT==   [        U5      -  ss'   M     [        S5      [        S5      44/U R                  -  nUR                  5        H\  u  pHXR                  U   =(       d    S-  nU(       d  M(  [        SU* 5      [        US5      4[        U* S5      [        SU5      44Xt'   M^     [        U 5      n	[        R                  " U6  H  n
[!        U
6 u  pX   X'   M     U	$ s  snf )a"  
Roll array elements along a given axis.

Elements that roll beyond the last position are re-introduced at
the first.

Parameters
----------
a : array_like
    Input array.
shift : int or tuple of ints
    The number of places by which elements are shifted.  If a tuple,
    then `axis` must be a tuple of the same size, and each of the
    given axes is shifted by the corresponding number.  If an int
    while `axis` is a tuple of ints, then the same value is used for
    all given axes.
axis : int or tuple of ints, optional
    Axis or axes along which elements are shifted.  By default, the
    array is flattened before shifting, after which the original
    shape is restored.

Returns
-------
res : ndarray
    Output array, with the same shape as `a`.

See Also
--------
rollaxis : Roll the specified axis backwards, until it lies in a
           given position.

Notes
-----
Supports rolling over multiple dimensions simultaneously.

Examples
--------
>>> import numpy as np
>>> x = np.arange(10)
>>> np.roll(x, 2)
array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7])
>>> np.roll(x, -2)
array([2, 3, 4, 5, 6, 7, 8, 9, 0, 1])

>>> x2 = np.reshape(x, (2, 5))
>>> x2
array([[0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9]])
>>> np.roll(x2, 1)
array([[9, 0, 1, 2, 3],
       [4, 5, 6, 7, 8]])
>>> np.roll(x2, -1)
array([[1, 2, 3, 4, 5],
       [6, 7, 8, 9, 0]])
>>> np.roll(x2, 1, axis=0)
array([[5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4]])
>>> np.roll(x2, -1, axis=0)
array([[5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4]])
>>> np.roll(x2, 1, axis=1)
array([[4, 0, 1, 2, 3],
       [9, 5, 6, 7, 8]])
>>> np.roll(x2, -1, axis=1)
array([[1, 2, 3, 4, 0],
       [6, 7, 8, 9, 5]])
>>> np.roll(x2, (1, 1), axis=(1, 0))
array([[9, 5, 6, 7, 8],
       [4, 0, 1, 2, 3]])
>>> np.roll(x2, (2, 1), axis=(1, 0))
array([[8, 9, 5, 6, 7],
       [3, 4, 0, 1, 2]])

Nr   T)allow_duplicater   z4'shift' and 'axis' should be scalars or 1D sequences)r   rM   r   r   ro   normalize_axis_tupler   r   r   r   intsliceitemsr   	itertoolsproductzip)rl   r   r   broadcastedr   shiftsshrollsoffsetresultrU   	arr_index	res_indexs                rp   rM   rM     sx   X 	1A|AGGIua(0099 $D&&$G,aFH H"'-0-Ba%-0!FBJ#b'!J " ;d,./!&&8 ,,.JBggbk&Q&Fv#D6'2E&$4GH#VGT2E$4GHJ		 ) A ((%0G#&= I !F 1 # 1s   Fc                     U 4$ ri   rj   )rl   r   starts      rp   _rollaxis_dispatcherr     r   rs   c                 R   U R                   n[        X5      nUS:  a  X#-  nSnSUs=::  a	  US-   :  d  O  [        USU* SUS-   U4-  5      eX:  a  US-  nX:X  a  U S   $ [        [	        SU5      5      nUR                  U5        UR                  X!5        U R                  U5      $ )aG	  
Roll the specified axis backwards, until it lies in a given position.

This function continues to be supported for backward compatibility, but you
should prefer `moveaxis`. The `moveaxis` function was added in NumPy
1.11.

Parameters
----------
a : ndarray
    Input array.
axis : int
    The axis to be rolled. The positions of the other axes do not
    change relative to one another.
start : int, optional
    When ``start <= axis``, the axis is rolled back until it lies in
    this position. When ``start > axis``, the axis is rolled until it
    lies before this position. The default, 0, results in a "complete"
    roll. The following table describes how negative values of ``start``
    are interpreted:

    .. table::
       :align: left

       +-------------------+----------------------+
       |     ``start``     | Normalized ``start`` |
       +===================+======================+
       | ``-(arr.ndim+1)`` | raise ``AxisError``  |
       +-------------------+----------------------+
       | ``-arr.ndim``     | 0                    |
       +-------------------+----------------------+
       | |vdots|           | |vdots|              |
       +-------------------+----------------------+
       | ``-1``            | ``arr.ndim-1``       |
       +-------------------+----------------------+
       | ``0``             | ``0``                |
       +-------------------+----------------------+
       | |vdots|           | |vdots|              |
       +-------------------+----------------------+
       | ``arr.ndim``      | ``arr.ndim``         |
       +-------------------+----------------------+
       | ``arr.ndim + 1``  | raise ``AxisError``  |
       +-------------------+----------------------+

    .. |vdots|   unicode:: U+22EE .. Vertical Ellipsis

Returns
-------
res : ndarray
    For NumPy >= 1.10.0 a view of `a` is always returned. For earlier
    NumPy versions a view of `a` is returned only if the order of the
    axes is changed, otherwise the input array is returned.

See Also
--------
moveaxis : Move array axes to new positions.
roll : Roll the elements of an array by a number of positions along a
    given axis.

Examples
--------
>>> import numpy as np
>>> a = np.ones((3,4,5,6))
>>> np.rollaxis(a, 3, 1).shape
(3, 6, 4, 5)
>>> np.rollaxis(a, 2).shape
(5, 3, 4, 6)
>>> np.rollaxis(a, 1, 4).shape
(3, 5, 6, 4)

r   z5'%s' arg requires %d <= %s < %d, but %d was passed inr   r   .)r   r1   r>   r   r   removeinsertr   )rl   r   r   nmsgr   s         rp   rN   rN     s    R 	
A(Dqy

ACQwGQUEBBCC|
}vaDKKKK;;trs   znumpy.lib.array_utilsc           
         [        U 5      [        [        4;  a   [        R                  " U 5      /n [        U  Vs/ s H  n[        XAU5      PM     sn5      n U(       dM  [        [        U 5      5      [        U 5      :w  a,  U(       a  [        SR                  U5      5      e[        S5      eU $ ! [
         a     Nf = fs  snf )a&  
Normalizes an axis argument into a tuple of non-negative integer axes.

This handles shorthands such as ``1`` and converts them to ``(1,)``,
as well as performing the handling of negative indices covered by
`normalize_axis_index`.

By default, this forbids axes from being specified multiple times.

Used internally by multi-axis-checking logic.

Parameters
----------
axis : int, iterable of int
    The un-normalized index or indices of the axis.
ndim : int
    The number of dimensions of the array that `axis` should be normalized
    against.
argname : str, optional
    A prefix to put before the error message, typically the name of the
    argument.
allow_duplicate : bool, optional
    If False, the default, disallow an axis from being specified twice.

Returns
-------
normalized_axes : tuple of int
    The normalized axis index, such that `0 <= normalized_axis < ndim`

Raises
------
AxisError
    If any axis provided is out of range
ValueError
    If an axis is repeated

See also
--------
normalize_axis_index : normalizing a single scalar axis
zrepeated axis in `{}` argumentzrepeated axis)r   tupler   operatorindexr   r1   r   setr   format)r   r   argnamer   r   s        rp   r   r   j  s    V Dz%&	NN4()D DIDb&r9DIJDs3t9~T:=DDWMNN_--K  		 Js   B. B>.
B;:B;c                     U 4$ ri   rj   )rl   sourcedestinations      rp   _moveaxis_dispatcherr    r   rs   c                     U R                   n[        XR                  S5      n[        X R                  S5      n[        U5      [        U5      :w  a  [        S5      e[        U R                  5       Vs/ s H  oDU;  d  M
  UPM     nn[        [        X!5      5       H  u  pgUR                  Xg5        M     U" U5      nU$ ! [         a    [        U 5      n U R                   n Nf = fs  snf )a  
Move axes of an array to new positions.

Other axes remain in their original order.

Parameters
----------
a : np.ndarray
    The array whose axes should be reordered.
source : int or sequence of int
    Original positions of the axes to move. These must be unique.
destination : int or sequence of int
    Destination positions for each of the original axes. These must also be
    unique.

Returns
-------
result : np.ndarray
    Array with moved axes. This array is a view of the input array.

See Also
--------
transpose : Permute the dimensions of an array.
swapaxes : Interchange two axes of an array.

Examples
--------
>>> import numpy as np
>>> x = np.zeros((3, 4, 5))
>>> np.moveaxis(x, 0, -1).shape
(4, 5, 3)
>>> np.moveaxis(x, -1, 0).shape
(5, 3, 4)

These all achieve the same result:

>>> np.transpose(x).shape
(5, 4, 3)
>>> np.swapaxes(x, 0, -1).shape
(5, 4, 3)
>>> np.moveaxis(x, [0, 1], [-1, -2]).shape
(5, 4, 3)
>>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape
(5, 4, 3)

r  r  zJ`source` and `destination` arguments must have the same number of elements)r   AttributeErrorr   r   r   r   r   r   sortedr   r   )	rl   r  r  r   r  rm   destsrcr   s	            rp   rO   rO     s    ` KK	
 "&&&(;F&{FFMJK
6{c+&& 7 8 	8 aff91&QE9C45	T 6 uFM!   AJKK	  :s   C 4	C(C(!C%$C%c                     X4$ ri   rj   )rl   r   axisaaxisbaxiscr   s         rp   _cross_dispatcherr    r   rs   c                    Ub	  U4S-  u  p#n[        U 5      n [        U5      nU R                  S:  d  UR                  S:  a  [        S5      e[        X R                  SS9n[        X1R                  SS9n[	        XS5      n [	        XS5      nSnU R
                  S   S	;  d  UR
                  S   S	;  a  [        U5      eU R
                  S   S
:X  d  UR
                  S   S
:X  a  [        R                  " S[        S
S9  [        U S   US   5      R
                  nU R
                  S   S:X  d  UR
                  S   S:X  a  US-  n[        U[        U5      SS9n[        U R                  UR                  5      n[        Xx5      n	U R                  U5      n UR                  U5      nU S   n
U S   nU R
                  S   S:X  a  U S   nUS   nUS   nUR
                  S   S:X  a  US   nU	R                  S:w  a"  U	R
                  S   S:X  a  U	S   nU	S   nU	S   nU R
                  S   S
:X  al  UR
                  S   S
:X  a  [        XU	S9  XU-  -  n	U	$ UR
                  S   S:X  d   e[        UWWS9  [        XWS9  [!        UUS9  [        XWS9  UX-  -  nOU R
                  S   S:X  d   eUR
                  S   S:X  aQ  [        UWWS9  [#        WU-  5      nUU-  n[        XWS9  [        XUS9  UU-  n[        XWS9  [        XUS9  UU-  nOEUR
                  S   S
:X  d   e[        WUWS9  [!        UUS9  [        XWS9  [        XWS9  UX-  -  n[	        U	SU5      $ )a  
Return the cross product of two (arrays of) vectors.

The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular
to both `a` and `b`.  If `a` and `b` are arrays of vectors, the vectors
are defined by the last axis of `a` and `b` by default, and these axes
can have dimensions 2 or 3.  Where the dimension of either `a` or `b` is
2, the third component of the input vector is assumed to be zero and the
cross product calculated accordingly.  In cases where both input vectors
have dimension 2, the z-component of the cross product is returned.

Parameters
----------
a : array_like
    Components of the first vector(s).
b : array_like
    Components of the second vector(s).
axisa : int, optional
    Axis of `a` that defines the vector(s).  By default, the last axis.
axisb : int, optional
    Axis of `b` that defines the vector(s).  By default, the last axis.
axisc : int, optional
    Axis of `c` containing the cross product vector(s).  Ignored if
    both input vectors have dimension 2, as the return is scalar.
    By default, the last axis.
axis : int, optional
    If defined, the axis of `a`, `b` and `c` that defines the vector(s)
    and cross product(s).  Overrides `axisa`, `axisb` and `axisc`.

Returns
-------
c : ndarray
    Vector cross product(s).

Raises
------
ValueError
    When the dimension of the vector(s) in `a` and/or `b` does not
    equal 2 or 3.

See Also
--------
inner : Inner product
outer : Outer product.
linalg.cross : An Array API compatible variation of ``np.cross``,
               which accepts (arrays of) 3-element vectors only.
ix_ : Construct index arrays.

Notes
-----
Supports full broadcasting of the inputs.

Dimension-2 input arrays were deprecated in 2.0.0. If you do need this
functionality, you can use::

    def cross2d(x, y):
        return x[..., 0] * y[..., 1] - x[..., 1] * y[..., 0]

Examples
--------
Vector cross-product.

>>> import numpy as np
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> np.cross(x, y)
array([-3,  6, -3])

One vector with dimension 2.

>>> x = [1, 2]
>>> y = [4, 5, 6]
>>> np.cross(x, y)
array([12, -6, -3])

Equivalently:

>>> x = [1, 2, 0]
>>> y = [4, 5, 6]
>>> np.cross(x, y)
array([12, -6, -3])

Both vectors with dimension 2.

>>> x = [1,2]
>>> y = [4,5]
>>> np.cross(x, y)
array(-3)

Multiple vector cross-products. Note that the direction of the cross
product vector is defined by the *right-hand rule*.

>>> x = np.array([[1,2,3], [4,5,6]])
>>> y = np.array([[4,5,6], [1,2,3]])
>>> np.cross(x, y)
array([[-3,  6, -3],
       [ 3, -6,  3]])

The orientation of `c` can be changed using the `axisc` keyword.

>>> np.cross(x, y, axisc=0)
array([[-3,  3],
       [ 6, -6],
       [-3,  3]])

Change the vector definition of `x` and `y` using `axisa` and `axisb`.

>>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]])
>>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]])
>>> np.cross(x, y)
array([[ -6,  12,  -6],
       [  0,   0,   0],
       [  6, -12,   6]])
>>> np.cross(x, y, axisa=0, axisb=0)
array([[-24,  48, -24],
       [-30,  60, -30],
       [-36,  72, -36]])

   r   z%At least one array has zero dimensionr  )
msg_prefixr  r   zDincompatible dimensions for cross product
(dimension must be 2 or 3))r=   r  r=   zvArrays of 2-dimensional vectors are deprecated. Use arrays of 3-dimensional vectors instead. (deprecated in NumPy 2.0))
stacklevel).r   )r  r  ).r   ).r=   r   )r   )r   r   r   r1   rO   ro   warningswarnDeprecationWarningr   r   r*   r   r   rF   r8   negativer   )rl   r   r  r  r  r   r  ro   r   cpa0a1a2b0b1b2cp0cp1cp2tmps                       rp   rP   rP     st   r #gke
A
A	

@AA !7CE 7CE 	2A2A(Cwwr{& AGGBKv$=owwr{a1772;!+G1	
 ai6+11Ewwr{a1772;!+$UCJ7K!''177+E	u	B 	
A	A 
6B	
6Bwwr{avY	
6B	
6Bwwr{avY	ww!|)jjjwwr{a772;!R$r'MBI772;!### R%R%Sc"R%27NCwwr{a772;! R%R.C3JCR%R%3JCR%R%3JC772;!### R%Sc"R%R%27NCBE""rs   littlec                    [        U 5      n [        U 5      nSU-  nU(       a  [        5       nO[        U4U -   US9n[        U 5       H>  u  pg[	        XqS9R                  USU U4-   XFS-   S -   5      nU(       a  XX4-   nM:  XU'   M@     U$ )a  
Return an array representing the indices of a grid.

Compute an array where the subarrays contain index values 0, 1, ...
varying only along the corresponding axis.

Parameters
----------
dimensions : sequence of ints
    The shape of the grid.
dtype : dtype, optional
    Data type of the result.
sparse : boolean, optional
    Return a sparse representation of the grid instead of a dense
    representation. Default is False.

Returns
-------
grid : one ndarray or tuple of ndarrays
    If sparse is False:
        Returns one array of grid indices,
        ``grid.shape = (len(dimensions),) + tuple(dimensions)``.
    If sparse is True:
        Returns a tuple of arrays, with
        ``grid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)`` with
        dimensions[i] in the ith place

See Also
--------
mgrid, ogrid, meshgrid

Notes
-----
The output shape in the dense case is obtained by prepending the number
of dimensions in front of the tuple of dimensions, i.e. if `dimensions`
is a tuple ``(r0, ..., rN-1)`` of length ``N``, the output shape is
``(N, r0, ..., rN-1)``.

The subarrays ``grid[k]`` contains the N-D array of indices along the
``k-th`` axis. Explicitly::

    grid[k, i0, i1, ..., iN-1] = ik

Examples
--------
>>> import numpy as np
>>> grid = np.indices((2, 3))
>>> grid.shape
(2, 2, 3)
>>> grid[0]        # row indices
array([[0, 0, 0],
       [1, 1, 1]])
>>> grid[1]        # column indices
array([[0, 1, 2],
       [0, 1, 2]])

The indices can be used as an index into an array.

>>> x = np.arange(20).reshape(5, 4)
>>> row, col = np.indices((2, 3))
>>> x[row, col]
array([[0, 1, 2],
       [4, 5, 6]])

Note that it would be more straightforward in the above example to
extract the required elements directly with ``x[:2, :3]``.

If sparse is set to true, the grid will be returned in a sparse
representation.

>>> i, j = np.indices((2, 3), sparse=True)
>>> i.shape
(2, 1)
>>> j.shape
(1, 3)
>>> i        # row indices
array([[0],
       [1]])
>>> j        # column indices
array([[0, 1, 2]])

)r   rv   Nr   )r  r   r   	enumerater   r   )	
dimensionsr   sparseNro   rz   idimidxs	            rp   rU   rU     s    h z"JJAFEgQDO51J'S&.."1Ist,
 ,CF ( Jrs   r   r|   c                H    Ub  [        X0U4SU0UD6$ [        XS9nU " U0 UD6$ )a  
Construct an array by executing a function over each coordinate.

The resulting array therefore has a value ``fn(x, y, z)`` at
coordinate ``(x, y, z)``.

Parameters
----------
function : callable
    The function is called with N parameters, where N is the rank of
    `shape`.  Each parameter represents the coordinates of the array
    varying along a specific axis.  For example, if `shape`
    were ``(2, 2)``, then the parameters would be
    ``array([[0, 0], [1, 1]])`` and ``array([[0, 1], [0, 1]])``
shape : (N,) tuple of ints
    Shape of the output array, which also determines the shape of
    the coordinate arrays passed to `function`.
dtype : data-type, optional
    Data-type of the coordinate arrays passed to `function`.
    By default, `dtype` is float.
${ARRAY_FUNCTION_LIKE}

    .. versionadded:: 1.20.0

Returns
-------
fromfunction : any
    The result of the call to `function` is passed back directly.
    Therefore the shape of `fromfunction` is completely determined by
    `function`.  If `function` returns a scalar value, the shape of
    `fromfunction` would not match the `shape` parameter.

See Also
--------
indices, meshgrid

Notes
-----
Keywords other than `dtype` and `like` are passed to `function`.

Examples
--------
>>> import numpy as np
>>> np.fromfunction(lambda i, j: i, (2, 2), dtype=float)
array([[0., 0.],
       [1., 1.]])

>>> np.fromfunction(lambda i, j: j, (2, 2), dtype=float)
array([[0., 1.],
       [0., 1.]])

>>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int)
array([[ True, False, False],
       [False,  True, False],
       [False, False,  True]])

>>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int)
array([[0, 1, 2],
       [1, 2, 3],
       [2, 3, 4]])

r   rv   )_fromfunction_with_likerU   )functionro   r   r|   kwargsargss         rp   rV   rV   7  sI    B &>-2>6<> 	> 5&DT$V$$rs   c                 .    [        XS9R                  X#S9$ )Nrv   )rm   )r   r   )bufr   ro   rm   s       rp   _frombufferr<    s    c'///CCrs   c                     [        U [        5      =(       d3    [        U 5      [        ;   =(       d    [        U [        R
                  5      $ )a
  
Returns True if the type of `element` is a scalar type.

Parameters
----------
element : any
    Input argument, can be of any type and shape.

Returns
-------
val : bool
    True if `element` is a scalar type, False if it is not.

See Also
--------
ndim : Get the number of dimensions of an array

Notes
-----
If you need a stricter way to identify a *numerical* scalar, use
``isinstance(x, numbers.Number)``, as that returns ``False`` for most
non-numerical elements such as strings.

In most cases ``np.ndim(x) == 0`` should be used instead of this function,
as that will also return true for 0d arrays. This is how numpy overloads
functions in the style of the ``dx`` arguments to `gradient` and
the ``bins`` argument to `histogram`. Some key differences:

+------------------------------------+---------------+-------------------+
| x                                  |``isscalar(x)``|``np.ndim(x) == 0``|
+====================================+===============+===================+
| PEP 3141 numeric objects           | ``True``      | ``True``          |
| (including builtins)               |               |                   |
+------------------------------------+---------------+-------------------+
| builtin string and buffer objects  | ``True``      | ``True``          |
+------------------------------------+---------------+-------------------+
| other builtin objects, like        | ``False``     | ``True``          |
| `pathlib.Path`, `Exception`,       |               |                   |
| the result of `re.compile`         |               |                   |
+------------------------------------+---------------+-------------------+
| third-party objects like           | ``False``     | ``True``          |
| `matplotlib.figure.Figure`         |               |                   |
+------------------------------------+---------------+-------------------+
| zero-dimensional numpy arrays      | ``False``     | ``True``          |
+------------------------------------+---------------+-------------------+
| other numpy arrays                 | ``False``     | ``False``         |
+------------------------------------+---------------+-------------------+
| `list`, `tuple`, and other         | ``False``     | ``False``         |
| sequence objects                   |               |                   |
+------------------------------------+---------------+-------------------+

Examples
--------
>>> import numpy as np

>>> np.isscalar(3.1)
True

>>> np.isscalar(np.array(3.1))
False

>>> np.isscalar([3.1])
False

>>> np.isscalar(False)
True

>>> np.isscalar('numpy')
True

NumPy supports PEP 3141 numbers:

>>> from fractions import Fraction
>>> np.isscalar(Fraction(5, 17))
True
>>> from numbers import Number
>>> np.isscalar(Number())
True

)
isinstancegenericr   
ScalarTypenumbersNumber)elements    rp   rX   rX     s8    d w( 3G}
*3'7>>24rs   c                    S n[         R                  " U 5      n U S:X  a  SU=(       d    S-  $ U S:  aM  [        U 5      SS n[        U5      nUc  UO[        R
                  " XA5      nU" X5        UR                  U5      $ Uc  S[        U * 5      SS -   $ [        [        U * 5      SS 5      nSUS-
  -  U * :X  a  US-  nSUS-   -  U -   n[        U5      SS n[        U5      n[        R
                  " XA5      nU" X5        SXT-
  -  U-   $ )	a  
Return the binary representation of the input number as a string.

For negative numbers, if width is not given, a minus sign is added to the
front. If width is given, the two's complement of the number is
returned, with respect to that width.

In a two's-complement system negative numbers are represented by the two's
complement of the absolute value. This is the most common method of
representing signed integers on computers [1]_. A N-bit two's-complement
system can represent every integer in the range
:math:`-2^{N-1}` to :math:`+2^{N-1}-1`.

Parameters
----------
num : int
    Only an integer decimal number can be used.
width : int, optional
    The length of the returned string if `num` is positive, or the length
    of the two's complement if `num` is negative, provided that `width` is
    at least a sufficient number of bits for `num` to be represented in
    the designated form. If the `width` value is insufficient, an error is
    raised.

Returns
-------
bin : str
    Binary representation of `num` or two's complement of `num`.

See Also
--------
base_repr: Return a string representation of a number in the given base
           system.
bin: Python's built-in binary representation generator of an integer.

Notes
-----
`binary_repr` is equivalent to using `base_repr` with base 2, but about 25x
faster.

References
----------
.. [1] Wikipedia, "Two's complement",
    https://en.wikipedia.org/wiki/Two's_complement

Examples
--------
>>> import numpy as np
>>> np.binary_repr(3)
'11'
>>> np.binary_repr(-3)
'-11'
>>> np.binary_repr(3, width=4)
'0011'

The two's complement is returned when the input number is negative and
width is specified:

>>> np.binary_repr(-3, width=3)
'101'
>>> np.binary_repr(-3, width=5)
'11101'

c                 <    U b  X:  a  [        SU < SU< 35      eg g )NzInsufficient bit width=z provided for binwidth=)r   )widthbinwidths     rp   err_if_insufficient(binary_repr.<locals>.err_if_insufficient   s3    !1*E8+C(E  "2rs   r   0r   r=   N-1)r  r  binr   builtinsmaxzfill)numrF  rH  binaryrG  outwidthposwidthtwocomps           rp   rY   rY     s%   D ..
C
axejq!!	qS!"v; %H!h6 	E,||H%% =cT12&& 3t9QR=)H 8a< SD(A(Q,'#-G\!"%F6{H||H4H0(-.77rs   c                    SnU[        U5      :  a  [        S5      eUS:  a  [        S5      e[        [        U 5      5      n/ nU(       a#  UR	                  X4U-     5        XA-  nU(       a  M#  U(       a  UR	                  SU-  5        U S:  a  UR	                  S5        SR                  [        U=(       d    S5      5      $ )	a  
Return a string representation of a number in the given base system.

Parameters
----------
number : int
    The value to convert. Positive and negative values are handled.
base : int, optional
    Convert `number` to the `base` number system. The valid range is 2-36,
    the default value is 2.
padding : int, optional
    Number of zeros padded on the left. Default is 0 (no padding).

Returns
-------
out : str
    String representation of `number` in `base` system.

See Also
--------
binary_repr : Faster version of `base_repr` for base 2.

Examples
--------
>>> import numpy as np
>>> np.base_repr(5)
'101'
>>> np.base_repr(6, 5)
'11'
>>> np.base_repr(7, base=5, padding=3)
'00012'

>>> np.base_repr(10, base=16)
'A'
>>> np.base_repr(32, base=16)
'20'

$0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZz/Bases greater than 36 not handled in base_repr.r=   z+Bases less than 2 not handled in base_repr.rJ  r   rK   )r   r   absr   appendjoinreversed)numberbasepaddingdigitsrQ  rz   s         rp   rZ   rZ   J  s    P 4Fc&kJKK	FGG
c&k
C
C


6*%& # 

3=!z

3778CJ3'((rs   c                     [        U 5      nUR                  nUc  U$ UR                   Vs/ s H  n[        X4   S   U5      PM     nn[	        U5      $ s  snf )Nr   )r   fieldsnames_maketupr  )descrvaldtrb  namerz   s         rp   rd  rd    sS    	uBYYF~
:<((C($xQ-(CSz Ds   A)r|   c                6    Ub
  [        X US9$ SSKJn  U" XUS9$ )a5  
Return the identity array.

The identity array is a square array with ones on
the main diagonal.

Parameters
----------
n : int
    Number of rows (and columns) in `n` x `n` output.
dtype : data-type, optional
    Data-type of the output.  Defaults to ``float``.
${ARRAY_FUNCTION_LIKE}

    .. versionadded:: 1.20.0

Returns
-------
out : ndarray
    `n` x `n` array with its main diagonal set to one,
    and all other elements 0.

Examples
--------
>>> import numpy as np
>>> np.identity(3)
array([[1.,  0.,  0.],
       [0.,  1.,  0.],
       [0.,  0.,  1.]])

rv   r   )eyer4  )_identity_with_liker@   rj  )r  r   r|   rj  s       rp   r\   r\     s(    D "4%88qD))rs   c                 
    XX#4$ ri   rj   rl   r   rtolatol	equal_nans        rp   _allclose_dispatcherrq        $rs   c           
      V    [        [        XX#US95      n[        R                  " U5      $ )a	  
Returns True if two arrays are element-wise equal within a tolerance.

The tolerance values are positive, typically very small numbers.  The
relative difference (`rtol` * abs(`b`)) and the absolute difference
`atol` are added together to compare against the absolute difference
between `a` and `b`.

.. warning:: The default `atol` is not appropriate for comparing numbers
             with magnitudes much smaller than one (see Notes).

NaNs are treated as equal if they are in the same place and if
``equal_nan=True``.  Infs are treated as equal if they are in the same
place and of the same sign in both arrays.

Parameters
----------
a, b : array_like
    Input arrays to compare.
rtol : array_like
    The relative tolerance parameter (see Notes).
atol : array_like
    The absolute tolerance parameter (see Notes).
equal_nan : bool
    Whether to compare NaN's as equal.  If True, NaN's in `a` will be
    considered equal to NaN's in `b` in the output array.

Returns
-------
allclose : bool
    Returns True if the two arrays are equal within the given
    tolerance; False otherwise.

See Also
--------
isclose, all, any, equal

Notes
-----
If the following equation is element-wise True, then allclose returns
True.::

 absolute(a - b) <= (atol + rtol * absolute(b))

The above equation is not symmetric in `a` and `b`, so that
``allclose(a, b)`` might be different from ``allclose(b, a)`` in
some rare cases.

The default value of `atol` is not appropriate when the reference value
`b` has magnitude smaller than one. For example, it is unlikely that
``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet
``allclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure
to select `atol` for the use case at hand, especially for defining the
threshold below which a non-zero value in `a` will be considered "close"
to a very small or zero value in `b`.

The comparison of `a` and `b` uses standard broadcasting, which
means that `a` and `b` need not have the same shape in order for
``allclose(a, b)`` to evaluate to True.  The same is true for
`equal` but not `array_equal`.

`allclose` is not defined for non-numeric data types.
`bool` is considered a numeric data-type for this purpose.

Examples
--------
>>> import numpy as np
>>> np.allclose([1e10,1e-7], [1.00001e10,1e-8])
False

>>> np.allclose([1e10,1e-8], [1.00001e10,1e-9])
True

>>> np.allclose([1e10,1e-8], [1.0001e10,1e-9])
False

>>> np.allclose([1.0, np.nan], [1.0, np.nan])
False

>>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
True


)rn  ro  rp  )allrW   rN  r   )rl   r   rn  ro  rp  rz   s         rp   r]   r]     s'    l gaIF
GC==rs   c                 
    XX#4$ ri   rj   rm  s        rp   _isclose_dispatcherrv  	  rr  rs   c           	         S XX24 5       u  pVp2[        USS5      =nb1  UR                  S:w  a!  [        R                  " US5      n[	        XhS9nO [        U[        5      (       a  [        U5      n[        SS9   [        [        XV-
  5      X2[        U5      -  -   5      [        U5      -  XV:H  -  n	U(       a  U	[        U5      [        U5      -  -  n	SSS5        U	S	   $ ! , (       d  f       W	S	   $ = f)
ay
  
Returns a boolean array where two arrays are element-wise equal within a
tolerance.

The tolerance values are positive, typically very small numbers.  The
relative difference (`rtol` * abs(`b`)) and the absolute difference
`atol` are added together to compare against the absolute difference
between `a` and `b`.

.. warning:: The default `atol` is not appropriate for comparing numbers
             with magnitudes much smaller than one (see Notes).

Parameters
----------
a, b : array_like
    Input arrays to compare.
rtol : array_like
    The relative tolerance parameter (see Notes).
atol : array_like
    The absolute tolerance parameter (see Notes).
equal_nan : bool
    Whether to compare NaN's as equal.  If True, NaN's in `a` will be
    considered equal to NaN's in `b` in the output array.

Returns
-------
y : array_like
    Returns a boolean array of where `a` and `b` are equal within the
    given tolerance. If both `a` and `b` are scalars, returns a single
    boolean value.

See Also
--------
allclose
math.isclose

Notes
-----
For finite values, isclose uses the following equation to test whether
two floating point values are equivalent.::

 absolute(a - b) <= (atol + rtol * absolute(b))

Unlike the built-in `math.isclose`, the above equation is not symmetric
in `a` and `b` -- it assumes `b` is the reference value -- so that
`isclose(a, b)` might be different from `isclose(b, a)`.

The default value of `atol` is not appropriate when the reference value
`b` has magnitude smaller than one. For example, it is unlikely that
``a = 1e-9`` and ``b = 2e-9`` should be considered "close", yet
``isclose(1e-9, 2e-9)`` is ``True`` with default settings. Be sure
to select `atol` for the use case at hand, especially for defining the
threshold below which a non-zero value in `a` will be considered "close"
to a very small or zero value in `b`.

`isclose` is not defined for non-numeric data types.
:class:`bool` is considered a numeric data-type for this purpose.

Examples
--------
>>> import numpy as np
>>> np.isclose([1e10,1e-7], [1.00001e10,1e-8])
array([ True, False])

>>> np.isclose([1e10,1e-8], [1.00001e10,1e-9])
array([ True, True])

>>> np.isclose([1e10,1e-8], [1.0001e10,1e-9])
array([False,  True])

>>> np.isclose([1.0, np.nan], [1.0, np.nan])
array([ True, False])

>>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
array([ True, True])

>>> np.isclose([1e-8, 1e-7], [0.0, 0.0])
array([ True, False])

>>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0)
array([False, False])

>>> np.isclose([1e-10, 1e-10], [1e-20, 0.0])
array([ True,  True])

>>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0)
array([False,  True])

c              3   |   #    U  H2  n[        U[        [        [        45      (       a  UO
[	        U5      v   M4     g 7fri   )r>  r   floatcomplexr   )r   rl   s     rp   r   isclose.<locals>.<genexpr>}	  s3      %#A C011z!}D#s   :<r   Nmg      ?rv   ignore)invalidrj   )getattrkindr   r,   r   r>  r   ry  r?   
less_equalrY  isfiniteisnan)
rl   r   rn  ro  rp  xyr   rg  r   s
             rp   rW   rW   !	  s    x%#%A$ GT**7EJJ#<M##Ar*q#	As		!H	(	#SXtSVm';<QK V eAhq))F 
$ ": 
$	# ":s   9AC
C0c                     X4$ ri   rj   )r"  r#  rp  s      rp   _array_equal_dispatcherr  	  	    8Ors   c                 &    [        U 5      [        ;   $ ri   )r   _no_nan_typesrv   s    rp   _dtype_cannot_hold_nanr  	  s    ;-''rs   c                 |    [        U 5      [        U5      pU R                  UR                  :w  a  gU(       d/  [        R                  " [        X:H  5      R                  5       5      $ XL a  g[        U R                  5      =(       a    [        UR                  5      nU(       a/  [        R                  " [        X:H  5      R                  5       5      $ [        U 5      [        U5      pTXE:H  R                  5       (       d  g[        R                  " X)    X)    :H  R                  5       5      $ ! [         a     gf = f)a  
True if two arrays have the same shape and elements, False otherwise.

Parameters
----------
a1, a2 : array_like
    Input arrays.
equal_nan : bool
    Whether to compare NaN's as equal. If the dtype of a1 and a2 is
    complex, values will be considered equal if either the real or the
    imaginary component of a given value is ``nan``.

Returns
-------
b : bool
    Returns True if the arrays are equal.

See Also
--------
allclose: Returns True if two arrays are element-wise equal within a
          tolerance.
array_equiv: Returns True if input arrays are shape consistent and all
             elements equal.

Examples
--------
>>> import numpy as np

>>> np.array_equal([1, 2], [1, 2])
True

>>> np.array_equal(np.array([1, 2]), np.array([1, 2]))
True

>>> np.array_equal([1, 2], [1, 2, 3])
False

>>> np.array_equal([1, 2], [1, 4])
False

>>> a = np.array([1, np.nan])
>>> np.array_equal(a, a)
False

>>> np.array_equal(a, a, equal_nan=True)
True

When ``equal_nan`` is True, complex values with nan components are
considered equal if either the real *or* the imaginary components are nan.

>>> a = np.array([1 + 1j])
>>> b = a.copy()
>>> a.real = np.nan
>>> b.imag = np.nan
>>> np.array_equal(a, b, equal_nan=True)
True
FT)
r   r   ro   rN  r   r   rt  r  r   r  )r"  r#  rp  cannot_have_nana1nana2nans         rp   rS   rS   	  s    vgbkB 
xx288}}j2779::	x-bhh7 <1"((; }}WRX.22455 9eBi5N!!=="V*6
2779::-  s   D. .
D;:D;c                     X4$ ri   rj   r"  r#  s     rp   _array_equiv_dispatcherr  
  r  rs   c                      [        U 5      [        U5      p [        R                  " X5        [        R
                  " [        X:H  5      R                  5       5      $ ! [         a     gf = f! [         a     gf = f)a  
Returns True if input arrays are shape consistent and all elements equal.

Shape consistent means they are either the same shape, or one input array
can be broadcasted to create the same shape as the other one.

Parameters
----------
a1, a2 : array_like
    Input arrays.

Returns
-------
out : bool
    True if equivalent, False otherwise.

Examples
--------
>>> import numpy as np
>>> np.array_equiv([1, 2], [1, 2])
True
>>> np.array_equiv([1, 2], [1, 3])
False

Showing the shape equivalence:

>>> np.array_equiv([1, 2], [[1, 2], [1, 2]])
True
>>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]])
False

>>> np.array_equiv([1, 2], [[1, 2], [1, 3]])
False

F)r   r   r   r   rN  r   r   rt  r  s     rp   rT   rT   
  sr    JgbkBR$ ==BH-11344    s"   A A- 
A*)A*-
A:9A:)r   rg   c                   X4$ ri   rj   r  r   r   rg   s       rp   _astype_dispatcherr  6
  s
    :rs   c                   [        U [        R                  5      (       d(  [        U 5      (       d  [	        S[        U 5       S35      eUb  US:w  a  [        SU 35      eU R                  XS9$ )a  
Copies an array to a specified data type.

This function is an Array API compatible alternative to
`numpy.ndarray.astype`.

Parameters
----------
x : ndarray
    Input NumPy array to cast. ``array_likes`` are explicitly not
    supported here.
dtype : dtype
    Data type of the result.
copy : bool, optional
    Specifies whether to copy an array when the specified dtype matches
    the data type of the input array ``x``. If ``True``, a newly allocated
    array must always be returned. If ``False`` and the specified dtype
    matches the data type of the input array, the input array must be
    returned; otherwise, a newly allocated array must be returned.
    Defaults to ``True``.
device : str, optional
    The device on which to place the returned array. Default: None.
    For Array-API interoperability only, so must be ``"cpu"`` if passed.

    .. versionadded:: 2.1.0

Returns
-------
out : ndarray
    An array having the specified data type.

See Also
--------
ndarray.astype

Examples
--------
>>> import numpy as np
>>> arr = np.array([1, 2, 3]); arr
array([1, 2, 3])
>>> np.astype(arr, np.float64)
array([1., 2., 3.])

Non-copy case:

>>> arr = np.array([1, 2, 3])
>>> arr_noncpy = np.astype(arr, arr.dtype, copy=False)
>>> np.shares_memory(arr, arr_noncpy)
True

z1Input should be a NumPy array or scalar. It is a z	 instead.cpuz<Device not understood. Only "cpu" is allowed, but received: r   )r>  r   r'   rX   r   r   r   rF   r  s       rp   rF   rF   :
  s}    j q"**%%!Awiy*
 	
 fox
 	
 88E8%%rs   c                     [        [        5      nU R                  nU H  nX1;  d  M
  [        R                  U5        M!     g ri   )r  __all__rZ  )rA   existingmallrl   s       rp   
extend_allr  
  s0    7|H>>DNN1 rs   )*)fromnumeric)
arrayprint)_asarray)_ufunc_config)NNNN)NKTN)NC)NNri   )valid)rd   )r=   )r   )NF)r   r   r   N)r=   r   )NNN)gh㈵>g:0yE>F)F)	functoolsr   r  sysr  rA  rN  r   r@   r   rX  r   r   ntr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   
exceptionsr>   r  r?   rc   r   rC   rB   partialarray_function_dispatchr  rq   rH   r[   r   r   rI   r   rd   r   r   re   r   rD   rG   r   rE   r   r^   r   rJ   r   rK   r   rL   r   rQ   r   rM   r   rN   r   r  rO   r  rP   	byteorderrR   r   rU   ry  rV   r6  r<  rX   rY   rZ   rd  r\   rk  rq  r]   rv  rW   r  r   int8int16int32int64r  r  rS   r  rT   r  rF   r_   r`   ra   rb   r  r  r  r  rj   rs   rp   <module>r     s5      
                       ? 5 5  " #S	
#++%%g7 & 26AE /004E@DE 1EP G>D >  >B *+D1 26AE ./04C@DC 0CN *.9=D G>T >  >B *+D1 >B ./<@KK 0K\  23BCE BC 4BCJ G? ?D -./! //!d 01&& 2&&R ./H- 0H-V -.`2 /`2F *+TG ,TGn ./Q$ 0Q$h )*f +fR -.W /Wt #$6 %6r -.B /BJ *+X# ,X#v (* G!% b bJ G+0t D%  D%N 23LA D GS4 S4l Gh8 h8V G6) 6)z G$*D $*  $*N ./9  -.V /Vr ,-s .sl 	rwwrwwrxxrxxrxx( 01R; 2R;j 01-5 2-5` -1  +, $T >& ->&B 		
           
;  
5  
<  
:  
8  
= rs   