File: //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraysetops.pyc
�
�9Zc @` s� d Z d d l m Z m Z m Z d d l Z d d d d d d d
g Z d d d � Z e
e
e
d � Z e
d
� Z e
d � Z
e
e
d � Z d � Z e
d � Z d S( s
Set operations for 1D numeric arrays based on sorting.
:Contains:
ediff1d,
unique,
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
i ( t divisiont absolute_importt print_functionNt ediff1dt intersect1dt setxor1dt union1dt setdiff1dt uniquet in1dc C` s� t j | � j } | d | d } | g } | d k rL | j d | � n | d k rh | j | � n t | � d k r� t j | � } n | S( s?
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])
i i����i N( t npt
asanyarrayt flatt Nonet insertt appendt lent hstack( t aryt to_endt to_begint edt arrays( ( sH /opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraysetops.pyR &