ó É9Zc@`s–dZddlmZmZmZddlZddgZdefd„ƒYZ d„Z dde d „Z d „Ze d „Zd „Zd „ZdS(sĒ Utilities that manipulate strides to achieve desirable effects. An explanation of strides can be found in the "ndarray.rst" file in the NumPy reference guide. i(tdivisiontabsolute_importtprint_functionNt broadcast_totbroadcast_arrayst DummyArraycB`seZdZdd„ZRS(s„Dummy object that just exists to hang __array_interface__ dictionaries and possibly keep alive a reference to a base array. cC`s||_||_dS(N(t__array_interface__tbase(tselft interfaceR((sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyt__init__s N(t__name__t __module__t__doc__tNoneR (((sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyRscC`sPt|ƒt|ƒk rL|jdt|ƒƒ}|jrL|j|ƒqLn|S(Nttype(Rtviewt__array_finalize__(toriginal_arrayt new_array((sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyt_maybe_view_as_subclasss  cC`sÃtj|dtd|ƒ}t|jƒ}|dk rIt|ƒ|d>ss4all elements of broadcast shape must be non-negativet reduce_okt readwritetreadonlytflagst multi_indextrefs_okt zerosize_oktop_flagst itershapetordertCi(RtiterableRRRRt ValueErrortanyR(t writeabletnditertitviewsRtTrue( RRRR'tneeds_writeabletextrastop_flagt broadcasttresult((sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyt _broadcast_to9s $cC`st||d|dtƒS(sĖBroadcast an array to a new shape. Parameters ---------- array : array_like The array to broadcast. shape : tuple The shape of the desired array. subok : bool, optional If True, then sub-classes will be passed-through, otherwise the returned array will be forced to be a base-class array (default). Returns ------- broadcast : array A readonly view on the original array with the given shape. It is typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. Raises ------ ValueError If the array is not compatible with the new shape according to NumPy's broadcasting rules. Notes ----- .. versionadded:: 1.10.0 Examples -------- >>> x = np.array([1, 2, 3]) >>> np.broadcast_to(x, (3, 3)) array([[1, 2, 3], [1, 2, 3], [1, 2, 3]]) RR'(R<R6(RRR((sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyRMs&cG`s|stdƒ‚ntj|d Œ}xOtdt|ƒdƒD]5}td|jƒ}tj||||d!Œ}qAW|jS(stReturns the shape of the ararys that would result from broadcasting the supplied arrays against each other. s"must provide at least one argumenti ii(R1RR:trangetlenRR(targstbtpos((sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyt_broadcast_shapevs!c `sž|jdtƒ}|r6tdj|jƒƒƒ‚ng|D]!}tj|dtd|ƒ^q=}t|Œ‰t‡fd†|Dƒƒr|Sg|D]!}t|ˆd|dtƒ^q—S(są Broadcast any number of arrays against each other. Parameters ---------- `*args` : array_likes The arrays to broadcast. subok : bool, optional If True, then sub-classes will be passed-through, otherwise the returned arrays will be forced to be a base-class array (default). Returns ------- broadcasted : list of arrays These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first. Examples -------- >>> x = np.array([[1,2,3]]) >>> y = np.array([[1],[2],[3]]) >>> np.broadcast_arrays(x, y) [array([[1, 2, 3], [1, 2, 3], [1, 2, 3]]), array([[1, 1, 1], [2, 2, 2], [3, 3, 3]])] Here is a useful idiom for getting contiguous copies instead of non-contiguous views. >>> [np.array(a) for a in np.broadcast_arrays(x, y)] [array([[1, 2, 3], [1, 2, 3], [1, 2, 3]]), array([[1, 1, 1], [2, 2, 2], [3, 3, 3]])] Rs8broadcast_arrays() got an unexpected keyword argument {}Rc3`s|]}|jˆkVqdS(N(R(R#R(R(sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pys ÁsR'( tpopRt TypeErrortformatRRRBtallR<(R?tkwargsRt_mR((RsJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyR‰s0 . (R t __future__RRRtnumpyRt__all__tobjectRRRRR"R<RRBR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/stride_tricks.pyts     )