Your IP : 216.73.216.213
(��^�N � @ s� d Z d d l m Z m Z m Z d d l Z d d d d d d d
d g Z d d d d � Z d
d
d
d d d � Z d
d
d
d d � Z
d
d d � Z d
d d � Z d
d
d d
� Z
d
d
d d � Z d d � Z d
d d � Z d S)a
Set operations for arrays based on sorting.
:Contains:
unique,
isin,
ediff1d,
intersect1d,
setxor1d,
in1d,
union1d,
setdiff1d
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in some operations by an implementation of
sort(), that can provide directly the permutation vectors, avoiding
thus calls to argsort().
To do: Optionally return indices analogously to unique for all functions.
:Author: Robert Cimrman
� )�division�absolute_import�print_functionN�ediff1d�intersect1d�setxor1d�union1d� setdiff1d�unique�in1d�isinc C sr t j | � j � } | d k rI | d k rI | d d � | d d � S| d k r^ d } n! t j | � j � } t | � } | d k r� d } n! t j | � j � } t | � } t t | � d d � } t j | | | d | j �} | j | � } | d k r| | d | � <| d k r9| | | | d � <t j | d d � | d d � | | | | � � | S)a?
The differences between consecutive elements of an array.
Parameters
----------
ary : array_like
If necessary, will be flattened before the differences are taken.
to_end : array_like, optional
Number(s) to append at the end of the returned differences.
to_begin : array_like, optional
Number(s) to prepend at the beginning of the returned differences.
Returns
-------
ediff1d : ndarray
The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``.
See Also
--------
diff, gradient
Notes
-----
When applied to masked arrays, this function drops the mask information
if the `to_begin` and/or `to_end` parameters are used.
Examples
--------
>>> x = np.array([1, 2, 4, 7, 0])
>>> np.ediff1d(x)
array([ 1, 2, 3, -7])
>>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99]))
array([-99, 1, 2, 3, -7, 88, 99])
The returned array is always 1D.
>>> y = [[1, 2, 4], [1, 6, 24]]
>>> np.ediff1d(y)
array([ 1, 2, -3, 5, 18])
N� r �dtype���r ) �np�
asanyarray�ravel�len�max�emptyr Z__array_wrap__�subtract)ZaryZto_endZto_beginZl_beginZl_endZl_diff�result� r �H/opt/alt/python35/lib64/python3.5/site-packages/numpy/lib/arraysetops.pyr '