σ °Ώv]c@`sβdZddlmZmZmZddlZddlmZddgZ de fd„ƒYZ d „Z ddeed „Zd „Zdd „Zeed dƒed„ƒZd„Zd„Zeed dƒd„ƒ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_functionN(tarray_function_dispatcht 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((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyt__init__s N(t__name__t __module__t__doc__tNoneR (((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyRscC`sPt|ƒt|ƒk rL|jdt|ƒƒ}|jrL|j|ƒqLn|S(Nttype(Rtviewt__array_finalize__(toriginal_arrayt new_array((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyt_maybe_view_as_subclasss  cC`sΔtj|dtd|ƒ}t|jƒ}|dk rIt|ƒ|dyss4all 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((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyt _broadcast_tots$$cC`s|fS(N((RRR((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyt_broadcast_to_dispatcher‹stmoduletnumpycC`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((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/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((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyt_broadcast_shapeΉs!cO`s|S(N((RCtkwargs((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyt_broadcast_arrays_dispatcherΜsc `sΖ|jdtƒ}|r@tdjt|jƒƒdƒƒ‚ng|D]!}tj|dtd|ƒ^qG}t|Œ‰t ‡fd†|Dƒƒrš|Sg|D]!}t |ˆd|dtƒ^q‘S(sU 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([[4],[5]]) >>> np.broadcast_arrays(x, y) [array([[1, 2, 3], [1, 2, 3]]), array([[4, 4, 4], [5, 5, 5]])] 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]]), array([[4, 4, 4], [5, 5, 5]])] Rs:broadcast_arrays() got an unexpected keyword argument {!r}iRc3`s|]}|jˆkVqdS(N(R(R%R(R(sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pys sR)( tpopRt TypeErrortformattlisttkeysRRRFtallR=(RCRGRt_mR((Rsg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyRΠs- . (Rt __future__RRRR@Rtnumpy.core.overridesRt__all__tobjectRRRRR6R$R=R>RRFRHR(((sg/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/lib/stride_tricks.pyts   M  )