Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python35
/
lib64
/
python3.5
/
site-packages
/
numpy
/
lib
/
__pycache__
/
File Content:
arraysetops.cpython-35.pyc
W��f�5 � @ 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 d � Z d d d d d � Z d d d � Z d d d � Z d d d d � Z d d � Z d d d � Z d S)a 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 � )�division�absolute_import�print_functionN�ediff1d�intersect1d�setxor1d�union1d� setdiff1d�unique�in1dc C s� t j | � j } | d d � | d d � } | g } | d k rU | j d | � | d k rn | j | � t | � d k r� t j | � } | 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]) � Nr ���)�np� asanyarrayZflat�insert�append�lenZhstack)ZaryZto_endZto_beginZedZarrays� r �/arraysetops.pyr &