ó 2ÄÈ[c@`s™dZddlmZmZmZddlZddgZdefd„ƒYZ d„Z dde e d „Zd „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((s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyt__init__s N(t__name__t __module__t__doc__tNoneR (((s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyRscC`sPt|ƒt|ƒk rL|jdt|ƒƒ}|jrL|j|ƒqLn|S(Nttype(Rtviewt__array_finalize__(toriginal_arrayt new_array((s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyt_maybe_view_as_subclasss  cC`sÄtj|dtd|ƒ}t|jƒ}|dk rIt|ƒ|dxss4all elements of broadcast shape must be non-negativet reduce_okt readwritetreadonlyR t multi_indextrefs_okt zerosize_oktop_flagst itershapetordertCi(RtiterableRRRRt ValueErrortanyR R!tnditertitviewsRtTrue( RRRR(tneeds_writeabletextrastop_flagtitt broadcasttresult((s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyt _broadcast_toss$$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<R5(RRR((s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyRŠs&cG`sv|s dStj|d Œ}xOtdt|ƒdƒD]5}td|jƒ}tj||||d!Œ}q6W|jS(stReturns the shape of the arrays that would result from broadcasting the supplied arrays against each other. i ii((RR:trangetlenRR(targstbtpos((s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyt_broadcast_shape³s!c `sÀ|jdtƒ}|r:tdj|jƒdƒƒ‚ng|D]!}tj|dtd|ƒ^qA}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]])] Rs:broadcast_arrays() got an unexpected keyword argument {!r}iRc3`s|]}|jˆkVqdS(N(R(R$R(R(s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pys þsR(( tpopRt TypeErrortformattkeysRRRBtallR<(R?tkwargsRt_mR((Rs6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyRÆs0 . (R t __future__RRRtnumpyRt__all__tobjectRRRRR5R#R<RRBR(((s6/tmp/pip-build-fiC0ax/numpy/numpy/lib/stride_tricks.pyts   M  )